Problems in recognising text with OCR from clear logical array

2 Ansichten (letzte 30 Tage)
Mat
Mat am 29 Jan. 2024
Beantwortet: Jonas am 30 Jan. 2024
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

Akzeptierte Antwort

Jonas
Jonas am 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
ans = 4×1 cell array
{'122591'} {'1EHEOE'} {'d1596M'} {'MTSEPL'}
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
ans = 4×1 cell array
{'132831'} {'1BHEOR'} {'41896M'} {'MTSGPU'}
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

Weitere Antworten (0)

Kategorien

Mehr zu Text Analytics Toolbox finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by