필터 지우기
필터 지우기

The OCR function works different between two similar images

조회 수: 3 (최근 30일)
Ahmad Gad
Ahmad Gad 2022년 7월 23일
답변: Image Analyst 2022년 7월 25일
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

답변 (2개)

Walter Roberson
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.
  댓글 수: 1
Ahmad Gad
Ahmad Gad 2022년 7월 25일
Thanks Walter for the answer.
I think in this current example, they both work regardless if the im2bw function is included or not. However, does this function has alternative? I want to optimize the code if possible.
Thanks!

댓글을 달려면 로그인하십시오.


Image Analyst
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.

카테고리

Help CenterFile Exchange에서 Computer Vision Toolbox에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by