Advertisement

This is an AttributeError stating that the object does not have the 'astype' attribute.

阅读量:
复制代码
    # 自定义函数数高斯模糊
    import cv2 as cv
    import numpy as np
    from matplotlib import pyplot as plt
    
    
    path = 'main.jpg'
    img = cv.imread(path, 0)
    
    # 自定义 根据窗口大小(10, 10)来计算高斯函数标准差
    kernel_size = (7, 7)
    sigma = 2
    blur = cv.GaussianBlur(img, kernel_size, sigma)
    
    img_new = blur.astype(np.uint8)
    
    plt.subplot(121), plt.imshow(img), plt.title('main')
    plt.xticks(), plt.yticks()
    plt.subplot(122), plt.imshow(blur), plt.title('median')
    plt.xticks(), plt.yticks()
    plt.show()
    
    # cv.imshow('img', blur)
    # cv.waitKey(0)
    

全部评论 (0)

还没有任何评论哟~