The OCR function works different between two similar images
3 次查看(过去 30 天)
显示 更早的评论
Hello there.
I am attaching a quite simple two similar images. They both contain the same text. Why MATLAB recognizes one correctly but not the other?
I am trying this code,
ocrResults = ocr(~im2bw(imread('test1.jpg')),'TextLayout','Block')
ocrResults = ocr(~im2bw(imread('test2.jpg')),'TextLayout','Block')
Best, Ahmad
0 个评论
回答(2 个)
Walter Roberson
2022-7-24
You should not be trusting that im2bw will isolate the text when you have multiple background colors. im2bw chooses the threshold automatically and might well decide to threshold between the two different backgrounds.
Image Analyst
2022-7-25
It's stated in the OCR documentation that the OCR is not reliable if the characters have less than 20 lines of data, which yours do not. Use a higher resolution image.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Language Support 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!