我有以下代码,当我尝试在阈值图像上执行关闭时,它看起来更糟,并且不会消除胡椒噪音。
自适应阈值的输出是多少?以及如何将其转换回可用格式以便可以应用结束?
或者你如何去除辣椒并改善边缘?
import cv2
import numpy as np
#import image
img = cv2.imread('Highway.jpg',0)
#actually finds the edges nicely
thresh = cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,\
cv2.THRESH_BINARY,11,2)
#closing is not removing the pepper look
#kernel = np.ones((5,5),np.uint8)
#closing = cv2.morphologyEx(th3, cv2.MORPH_CLOSE, kernel)