Problems in recognising text with OCR from clear logical array
5 views (last 30 days)
Show older comments
Hello, I have a clean image containing only some lines of text. It is the result of exporting a logical array of pixels.
Using OCR command, TEXT property results to be empty. I tried with jpg and png format, as in the attached figures.
The code I am using is just
xxx=imread(name_file);
ocr(xxx)
ans =
ocrText with properties:
Text: ''
CharacterBoundingBoxes: [0×4 double]
CharacterConfidences: [0×1 single]
Words: {0×1 cell}
WordBoundingBoxes: [0×4 double]
WordConfidences: [0×1 single]
TextLines: {0×1 cell}
TextLineBoundingBoxes: [0×4 double]
TextLineConfidences: [0×1 single]
Thank you very much
0 Comments
Accepted Answer
Jonas
on 30 Jan 2024
i guess it is just a mishandling of the automatic mode recognition:
I=imread('testOCR.png');
I=rgb2gray(I);
imshow(I);
c=ocr(I,"LayoutAnalysis","block");
c.Words
since this contains errors, you could try to blur out the edges, maybe this helps :D
J=imgaussfilt(I,4);
J=imsharpen(J,'Radius',4,'Amount',4);
imshow(J);
c=ocr(J,"LayoutAnalysis","block");
c.Words
this is better, but still not without errors (3 instead of 9 in the first line). maybe this can help you do change your image in such a way, that it can work
0 Comments
More Answers (0)
See Also
Categories
Find more on Text Analytics Toolbox 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!