Adaptive Threshold output unclear

476 views Asked by At

I have the following code and when I try to perform closing on the threshold image, it looks worse and doesn't remove the pepper noise.

What is the output of an adaptive threshold? and how can I convert this back into a usable format so that closing can be applied?

Or how would you remove the pepper and maybe improve the edges?

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)

Highway.jpg

0

There are 0 answers