drawContours as is, not filled, not just outline
Hi,
With cv2.drawContours is there a way to draw the exact contour as is? Not just the border, or not completely filled.
I'm using it for extracting alphabets from a text, and for characters like A, P, 4 etc, it fills them inside as well.
Eg: Input Binary Image:
Extracted problematic characters after drawContours:
Adding Code:
for contour in countours:
mask = np.zeros(img.shape[:2], dtype="uint8")
mask.fill(255)
cv2.drawContours(mask, [contour], 0, 0, cv2.FILLED)
cv2.rectangle(debugPlate, (x, y), (x+w, y+h), (0,255,0), 2)
x,y,w,h = cv2.boundingRect(contour)
charImg = mask[y:y+h, x:x+w]
cv2.imwrite('char', charImg)