Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Separating OCR Characters with 1 Pixel Spacing

This has been an issue for years and was hopeful that Vision 2013 would do this a bit better.  What I have is pages of meters that are captured using a frame grabber board.  They are all high quality images.  I have successfully used expanding the image, color pane extraction, and thresholding in auto and manual modes.  I can OCR about 99% accurate when thresholding the and doubling the size of the image.  The question is why doesn’t it just work?  There is a specific setting under Size & Spacing called, “ Min Char Spacing” in the NI OCR Training Interface.  If it has a full pixel character spacing why does this not work?  Equally as frustrating is depending on how you select the area, I get different result (see attached images).  Thoughts on what is going on?

 

BMP images are in the ZIP file

 

 

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 1 of 5
(5,875 Views)

Hi mfitzsimons,

 

For OCR, 99% is quite accurate. Unfortunately, in any sort of visual recognition application you're not going to be able to get 100% accuracy, and I would consider that result to be quite good.

 

However, a lot of things can affect the accuracy of your results. What character file are you using for your recognition? What sort of training have you done to make sure your results are accurate? Depending on what you already have set, you may be able to improve your accuracy by modifying your character file. Could you upload your file and application so I can see how it's working so far? We can see if you might be able to set something up differently, but at 99% I wouldn't expect a significant increase in accuracy.

 

Thank you,

Emily C
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(5,838 Views)

The main problem is the most common one I see on these forums:  Low resolution.  As a rule, you should match your image sensor to the smallest feature that needs to be distinguished.  What ever that feature is, you should strive to throw at LEAST four (4) pixels across the feature.  In the case of the letters you are trying to perform OCR on, the seaparation between them should be no less than four pixels.  If the PERIOD character is smaller in diameter than the narrowest letter spacing, you should match to the period, if it needs to be detected.

Machine Vision, Robotics, Embedded Systems, Surveillance

www.movimed.com - Custom Imaging Solutions
0 Kudos
Message 3 of 5
(5,831 Views)

Thanks for your replying and sharing your expertise on the topic.  Attached are zoomed images with grid lines on.  You can see that the 'l" is 4 pixels wide and '.' is 4 x 3 pixels.  Resolution is fixed since it is direct video capture of a 1280 x 800 monitor.  The separation between characters is fixed at 1 pixel and can't change that.  I would agree the test is a bit tight but 4 pixels between each character would look bad.  All I can do is enlarge the image to get more pixels between the characters.  In my opinion that the character separator in not as robust as I would expect but this still maybe the best OCR is these days.

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 4 of 5
(5,828 Views)

You have to account for the edge strength.  In you examples there is about a 3 pixel drop from white to black.  You cannot take all of the grey values into size consideration because all of the analysis eventually leads to a binary image, so if a characters is very thin, and the black becomes slightly grey due to blurring, or low resolution, chanves are it can be missed.

 

The OCR training is essentially running a classifier-type of identification.  Each character must be resolved as it is seen next to, and between every other possible combination of characters, if you want to obtain a complete classifier set.

 

Ordinarily, with good separation, each character only needs 1 to 3 variants to be learned.

 

I've done this in the past, to read recorded video of a medical device during an operation, where the device had no data acquisition capabilities on its own.  It was particularly challenging because the text was overlayed semi-transparent over the video of the live procedure.  Ultimately, the performance was about 99.97% accurate in detecting text, and 100% accurate in rejecting bad data, but I did not rely exclusively on OCR.  I used color analysis, and other information.

Machine Vision, Robotics, Embedded Systems, Surveillance

www.movimed.com - Custom Imaging Solutions
0 Kudos
Message 5 of 5
(5,821 Views)