我有以下代码,当我尝试对阈值图像执行关闭时,它看起来更糟并且没有消除胡椒噪声。
自适应阈值的输出是什么?以及如何将其转换回可用格式以便可以应用关闭?
或者你将如何去除胡椒粉并改善边缘?
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)