How to check if boxes in an image have text in it?

237 Views Asked by At

I have a table similar to this where the text is actually handwritten. I want to be able to check if each field has been filled out but understanding or recognising what each field says is not necessary. I just need to be able to detect that the field has been filled out.

example of table

People will have to scan pages with a scanner and the program should detect the fields and check if they have any contents essentially. Does anyone have any ideas or know of simple solutions. I was thinking using ICR or OCR but OCR can't detect handwritten text and ICR is only good if you pay for it but it is too good.

1

There are 1 best solutions below

0
cschuhknecht On

This could be very easy but it depends on how static the situation is. Convert the image to a grayscale image then apply a threshold to separate black and white. Next you have to ignore the too small white regions that belong to letters like a or o and then apply a closing to the remaining regions to get the single table cells. Now you can determine the average gray value at the position of each region. If it is above a certain value, then you have found a cell that is filled in. This method only works if the white background of a cell is somehow connected, otherwise the closing will not work as desired. The lighting situation is also critical with fixed threshold values.