karolzak / boxdetect

BoxDetect is a Python package based on OpenCV which allows you to easily detect rectangular shapes like character or checkbox boxes on scanned forms.
MIT License
105 stars 20 forks source link

challenging case on checkbox crossing outside box #17

Closed robbiedood closed 3 years ago

robbiedood commented 3 years ago

Dear Boxdetect friends and the author Karolzak,

My image is as shown attached, checked X crossing a little bit outside the box. So far we can not detect any checkbox, tried different configs. Hope to hear your expertise on the challenging case. boxdetect_failcase

Best, --Luke

karolzak commented 3 years ago

Hey @lukelu0520 Just by looking at the example you shared, seems like BoxDetect should handle that with a correct config. Is that image you share an actual document you're using as an input for BoxDetect or are you using a bigger image/doc? Can you share an example of a full size doc that you're using?

robbiedood commented 3 years ago

Hi @karolzak , I am grateful to get your response. Yes, the image is what we are using as an input for BoxDetect.

The latest update: after reading your source code (very neat coding & comprehensive comments!), we figured out that setting morph_kernels_type = 'rectangles' could solve the problem. 'rectangles' type takes longer processing but it works !

Thanks for creating BoxDetect ! --Luke