I'm trying to isolate letters in a captcha, I managed to filter a captcha and that result in this black and white image:
But when I tried to separate the letters with findContours method of OpenCV it just found a external contour that wraps my entire image, resulting in this image (black contour outside image).
I'm using this code with Python 3 and OpenCV 3.4.2.17:
img = threshold_image(img)
cv2.imwrite("images/threshold.png", img)
image, contours, _ = cv2.findContours(img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
for i, contour in enumerate(contours):
area = cv2.contourArea(contour)
cv2.drawContours(img, contours, i, (0, 0, 0), 3)
cv2.imwrite('images/output3.png', img)
I just want my final result is 5 contours outside each character.