Borrar filtros
Borrar filtros

The OCR function works different between two similar images

3 visualizaciones (últimos 30 días)
Ahmad Gad
Ahmad Gad el 23 de Jul. de 2022
Respondida: Image Analyst el 25 de Jul. de 2022
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

Respuestas (2)

Walter Roberson
Walter Roberson el 24 de Jul. de 2022
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 comentario
Ahmad Gad
Ahmad Gad el 25 de Jul. de 2022
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!

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 25 de Jul. de 2022
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.

Categorías

Más información sobre Computer Vision Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by