一、概念
边缘保留滤波(EPF,edge preserving filtering)
二、高斯双边
cv2.bilateralFilter(image,0,100,15)
100为差异,15为周围的区域
import cv2
import numpy as npdef bilateralFilter(image):dst = cv2.bilateralFilter(image,0,100,15)cv2.imshow('bilateralFilter',dst)src = cv2.imread(r"G:\Juptyer_workspace\study\opencv\opencv3\p.jpg")
cv2.imshow("image",src)
cv2.namedWindow("image",cv2.WINDOW_AUTOSIZE)bilateralFilter(src)cv2.waitKey(0)
cv2.destroyAllWindows()
效果图如下:
三、均值迁移
import cv2
import numpy as npdef MeanShiftFiltering(image):dst = cv2.pyrMeanShiftFiltering(image,10,50)cv2.imshow('MeanShiftFiltering',dst)src = cv2.imread(r"G:\Juptyer_workspace\study\opencv\opencv3\p.jpg")
cv2.imshow("image",src)
cv2.namedWindow("image",cv2.WINDOW_AUTOSIZE)MeanShiftFiltering(src)cv2.waitKey(0)
cv2.destroyAllWindows()
效果图如下: