Answer the question
In order to leave comments, you need to log in
How to remove unclosed areas in OpenCV?
I have this picture, I processed it, but still I can’t get the contours of the letters because of the extra noise:
1) Source:
2) After processing
And here is the processing code, what needs to be added to correctly find the contours of the letters?
def detecting_and_extracting_letters(path,out_size=28):
img = cv2.imread(path)
img = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
_, thresh = cv2.threshold(img,110,255, cv2.THRESH_BINARY)
img_erode = cv2.erode(thresh, np.ones((3, 3), np.uint8), iterations=1)
dilation = cv2.dilate(img_erode,np.ones((3, 3), np.uint8),iterations = 1)
contours, hierarchy = cv2.findContours(dilation, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
cv2.imshow("Input", img)
cv2.imshow("Enlarged", dilation)
cv2.waitKey(0)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question