OCR Text Recognition from Image Help

3 views (last 30 days)
Hi all, I would really appreciate some help recognizing some text in some black and white images. This is the last part of an automated code to read scale bars from some micrographs so this is very important in my entire analysis.
Attached is the image that I have and I simply want to read in the text that says 200 nm.
I use: ocr(Image)
but the text I get is: ' 1zn.s1 K x znn nm wn 5.3 mn Merlin-60-62 ?T Cnlumn Made = Analytic ' which is close but not what I need. Any suggestions? Any input will be greatly appreciated, Best, Nick

Accepted Answer

Alok Nimrani
Alok Nimrani on 16 May 2018
Hi Nikolaos,
You can use some of the image pre-processing techniques to improve the readability of the image such as:
• Resizing the image
• Converting the image to Gray scale and binarizing the image using appropriate thresholding level
• Noise removal and image sharpening
• Increasing the contrast of the image since low contrast can result in poor OCR
You can also leverage priori knowledge about the text within the image and improve the results by constraining ‘ocr’ to only select the best matches from the character set that you want to match. For example, since you want to read the text ‘200nm’, you can use a character set consisting of digits and the letters ‘n’ and ‘m’ as follows:
>> results = ocr(BW2, 'CharacterSet', '0123456789nm', 'TextLayout','Block');
>> results.Text
ans =
' m39 205 5 1 200nm 1m 0 48mn
3 m6062 1
60 nmn 0019 nn3 3n 0
'
You can then select the required text '200nm' from this result.
For more information about improving the OCR results, you can refer the following link: https://www.mathworks.com/help/vision/examples/recognize-text-using-optical-character-recognition-ocr.html
Hope this helps.
Thanks.
  1 Comment
Nikolaos Farmakidis
Nikolaos Farmakidis on 16 May 2018
Hi Alok, Many thanks for your answer. Unfortuntely I didn't have much luck with image editing, filtering and sharpenign but your second suggestion really helps. Thanks a lot Nick

Sign in to comment.

More Answers (0)

Categories

Find more on Language Support in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!