ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

help with OCR

I am doing a project where I need to do OCR on some printed lables

 

the font size is on 4...

and I am having a hard time seperating the letters - I am getting closer, but any hints would be highly appriciated!

 

ocr1 - orginal image

ocr3 - incresed brightness and contrasts

ocr4 - converted to binary, and used erode

 

 

Download All
0 Kudos
Message 1 of 7
(5,979 Views)

Try Gray Morphology - Dilate followed by Threshold.  To separate characters you need to be able to draw a straight line vertically between characters without touching anything (blank space).  You need to have at least one-pixel between characters.  See attached image and example.

 

 dialateThreshold.PNG

 

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
Download All
Message 2 of 7
(5,964 Views)
Thanks a lot, will try this tomorrow
Why dialate and not erode?
0 Kudos
Message 3 of 7
(5,956 Views)

Yes, seems to work in reverse of what you would think.  Play with both and you will see why I chose dilate.

 

Matt

 

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 4 of 7
(5,954 Views)
I will 🙂
And I was not aware that a straight horizontal line was needed to separate the letters, that explains a lot!
0 Kudos
Message 5 of 7
(5,950 Views)
Meant Vertical line of course ...
0 Kudos
Message 6 of 7
(5,946 Views)

That is why you get to enter a security phrase when you buy tickets to prevent OCR automated buying.

 

securityPhrase.PNG

 

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
Message 7 of 7
(5,945 Views)