1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| import cv2 img = cv2.imread("lingbosize.png") #均值滤波 #简单的平均卷积操作 blur = cv2.blur(img,(3,3))
#方框滤波 #normalize = True和均值一样,选择归一化 box = cv2.boxFilter(img,-1,(3,3),normalize=True) #-1表示得到颜色通道数一致 #没有选则归一化,容易越界,超过255当作255处理 box1 = cv2.boxFilter(img,-1,(3,3),normalize=False) cv2.imshow("blur",blur) cv2.waitKey(1000)
cv2.imshow("box",box) cv2.waitKey(1000)
cv2.imshow("box1",box1) cv2.waitKey(1000) cv2.waitKey(0)
|