OpenCV to close the contour - Python

I am working on extracting data from various financial forms and for which I need to close the contours of attribute 3a, 5b, and 6a (just like it is currently for attribute 4a) so that I can extract these closed boxes from the form and then use OCR to read the info inside the boxes.

I understand that I can use OpenCV morphological operations on this to identify shape but since it is not a defined shape like circle, ellipse or rectangle so don’t know how to proceed with this.

Thanks for your help guys, greatly appreciate it.

image

1 Like