Reading seven segment display with OCR command
8 ビュー (過去 30 日間)
古いコメントを表示
I am trying to read the digits off of Images of a seven segment display, like the one below.

b = imread('frame1.jpg'); %image above
imshow(b)
BW1 = imbinarize(rgb2gray(b),0.2);
BW2 = imcomplement(BW1);
figure; imshow(BW2); roi = round(getPosition(imrect));
imshowpair(BW1,BW2,'montage')
ocrResults = ocr(BW2,roi,'CharacterSet','.0123456789','TextLayout','word');
recognizedText = ocrResults.Text;
text(600, 150, recognizedText, 'BackgroundColor', [1 1 1]);
However the ocr command cannot read the digits correclty, as can be seen in the textbox on the processed image below.

Are there any pre-processing steps I should additionaly take?
Do I need to use the ocr command in a different way?
Thanks in advance for any suggestions
1 件のコメント
Brett Shoelson
2021 年 3 月 3 日
Attempts to do this using image morphology are almost certain to fail under certain conditions. Better: download and install a (freely available) 7-segment font, then use the OCR Trainer App to train the character recognition on samples of those digits. You'll get better results!
Brett
採用された回答
KALYAN ACHARJYA
2019 年 7 月 3 日
編集済み: KALYAN ACHARJYA
2019 年 7 月 3 日
One Suggestion: connect the disconneted pixels, then apply the OCR
Let me know the result, is it working?
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

