mercredi 14 avril 2021

OpenCV - Detecting that circular checkboxes are checked

I'm detecting and classifying circular checkboxes on document scans using cv2. Although I've had success with detecting unchecked checkboxes, checked ones are giving me trouble because they aren't checked in a regular manner that doesn't exceed the boundaries of the circle. Here's what some of those checked checkboxes look like:

enter image description here enter image description here enter image description here

Thus far, I've used adaptiveThresholding() and findContours(). I've also tried using Sobel and Canny operators, but to no avail. Gaussian blurring hasn't improved the performance of my solution. I'm checking how circular each contour is in a way that's very similar to what you can find here.

Here's an example document scan that I found online to help you check your solution:

enter image description here

Here's the output I'm getting for that scan right now:

enter image description here

As you can see, the classification bit hasn't been implemented yet.

Bear in mind that not all document scans have the same format, so hardcoding parameter values for a single image just won't cut it. For instance, sometimes the circular checkboxes will also be stacked in columns, not only in rows. Sometimes they'll have a black outline, sometimes not. Sometimes there'll be a label next to them, sometimes not etc.

Also, false positives are more acceptable than false negatives in this case.

How do I go about solving this?




Aucun commentaire:

Enregistrer un commentaire