Problems in recognising text with OCR from clear logical array

3 ビュー (過去 30 日間)
Mat
Mat 2024 年 1 月 29 日
回答済み: Jonas 2024 年 1 月 30 日
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

採用された回答

Jonas
Jonas 2024 年 1 月 30 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Analytics Toolbox についてさらに検索

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by