OCR not detecting numbers

17 Ansichten (letzte 30 Tage)
Chris
Chris am 26 Mär. 2025
Beantwortet: Image Analyst am 28 Mär. 2025
I'm trying to use OCR to read numbers from different photos. I have pre-processed the images as seen below, and it just won't detect some even though they look very reading. I've put the pre-processed photos below to show which ones are detected and which aren't.
Able to detect:
Not able to detect:
Also not detected:

Antworten (1)

Image Analyst
Image Analyst am 28 Mär. 2025
Maybe it's too big. Try shrinking it down to smaller images:
%--------------------------------------------------
% Read in original RGB image and convert to grayscale.
rgbImage = imread('72.png');
% Convert to gray level
binaryImage = rgbImage(:, :, 1) < 128;
binaryImage = imresize(binaryImage, 0.1);
imshow(binaryImage);
impixelinfo;
axis on
%--------------------------------------------------
% Find the number
txt = ocr(binaryImage, 'CharacterSet', '0123456789', 'LayoutAnalysis','line')
txt =
ocrText with properties: Text: '72...' CharacterBoundingBoxes: [4x4 double] CharacterConfidences: [4x1 single] Words: {'72'} WordBoundingBoxes: [24 11 88 69] WordConfidences: 0.5639 TextLines: {'72'} TextLineBoundingBoxes: [24 11 88 69] TextLineConfidences: 0.5639
fprintf('Detected "%s".\n', txt.Words{1})
Detected "72".

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by