Extract Digital Numbers from Image
Show older comments
Hi All.
I have lots of scale images that I would like to extract the scale reading from. I have looked through many sources such as "ocr" but when applying that it doesn't read the numbers shown. Attached is an image after processing (cropping. brightining..etc). I appreciate if someone can help me find a way to extract the numbers out of the image.
Accepted Answer
More Answers (2)
Image Analyst
on 3 Aug 2021
1 vote
I tried it with my new computer and developed a solution for seven segment LED displays that uses masking to examine the 7 locations where a segment would be. From the pattern or lit or non-lit, I can turn that into a number. It works, as in the attached demo.
I got word from a developer on the Computer Vision team that the ocr() function was not trained for seven segment characters. Still it's surprising how bad it is for certain numbers like thinking a 2 was an 8 and the 8 was a 9.

ANKUR KUMAR
on 13 Jul 2021
Edited: ANKUR KUMAR
on 13 Jul 2021
0 votes
You can simply use ocr command to do that. Refer to this documentation for some example, which would be a good starting point for you to take it forward.
3 Comments
Image Analyst
on 13 Jul 2021
Yep, I looked at that in my Answer. And I presume @Abdullah Azzam did too. Did you run my code or try the ocr function? So why is it saying the 2 is an 8?
Abdullah Azzam
on 13 Jul 2021
ANKUR KUMAR
on 13 Jul 2021
@Image Analyst OCR behaves wierd. I just tune the masking factor, and getting 137.313.
mask = conv2(double(mask), ones(windowSize)/windowSize^2, 'full') > 0.3;
I replaced 0.5 to 0.3. I played around masking thresholds and all, but not getting the exact value.
Categories
Find more on Convert Image Type 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!