OCR not detecting numbers
18 次查看(过去 30 天)
显示 更早的评论
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: 

1 个评论
Mathieu NOE
2025-3-26
hello
maybe you'll find some ideas here : Unable to Extract Numbers Using OCR Despite Performing Image Processing - MATLAB Answers - MATLAB Central
回答(1 个)
Image Analyst
2025-3-28
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')
fprintf('Detected "%s".\n', txt.Words{1})
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
