目录
破坏了图像的细节使图像变得模糊,同时不能很好的去除噪声
def blur_demo(image):
dst = cv.blur(image, (5, 5))
cv.imshow("blur_demo", dst)
中值滤波对降噪能起到很好的作用,同时尽可能保留图像的细节
def median_blur_demo(image):
dst = cv.medianBlur(image, 5)
cv.imshow("median_blur_demo", dst)
def custom_blur_demo(image):
#kernel = np.ones([5, 5], np.float32)/25
kernel = np.array([[0, -1, 0],[-1, 5, -1],[0, -1, 0]], np.float32)
dst = cv.filter2D(image, -1, kernel=kernel)
cv.imshow("custom_blur_demo", dst)
blur_1 = cv2.GaussianBlur(img,(5,5),0)#高斯滤波(5, 5)表示高斯矩阵的长与宽都是5,标准差取0
sobelx = cv.Sobel(img,cv.CV_64F,1,0,ksize=5)#Sobel算子为边沿检测中常用的算子之一,Sobel 算子计算一阶、二阶、三阶或混合图像差分
sobely = cv.Sobel(img,cv.CV_64F,0,1,ksize=5)
laplacian = cv.Laplacian(img,cv.CV_64F)#对图像求二阶导数,一般用于边缘突出,在边缘检测中应用为Laplacian滤波