# 自定义函数数高斯模糊
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)
错误 AttributeError: 'NoneType' object has no attribute 'astype'
最新推荐文章于 2024-09-08 12:39:31 发布