OCR different output values
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I've tried running ocr on an image with 4 different scales (1.0 , 1.1 , 1.2 , 1.3) and these are the results:

They're all different as shown. The script I used was the one from this comment:
Any ideas what could be the problem here?
EDIT:
Original image/ image I became after running a color detection on white;


Then for trying the proposed method (https://nl.mathworks.com/matlabcentral/answers/518915-find-image-in-scene#comment_832228) , I manually cropped first on the white background with the 1 first to see or ocr() could read it anyways, but I've found a variety of outputs (first picture).
The code I used for resizing the picture and the ocr() part was found on this link: (https://nl.mathworks.com/matlabcentral/answers/377444-why-ocr-function-doesn-t-recognize-the-numbers#answer_300566), since it gave me the right output tested on regular number pictures on google.
Code (from link above):
capture = imread('green1.jpg');
% Increase image size by x
my_image = imresize(capture, 1.3);
figure
imshow(my_image)
% Localize words
BW = imbinarize(rgb2gray(my_image));
BW1 = imdilate(BW,strel('disk',6));
s = regionprops(BW1,'BoundingBox');
bboxes = vertcat(s(:).BoundingBox);
% Sort boxes by image height
[~,ord] = sort(bboxes(:,2));
bboxes = bboxes(ord,:);
% Pre-process image to make letters thicker
BW = imdilate(BW,strel('disk',1));
% Call OCR and pass in location of words. Also, set TextLayout to 'word'
ocrResults = ocr(BW,bboxes,'CharacterSet','.0123456789','TextLayout','word');
words = {ocrResults(:).Text}';
words = deblank(words)
2 Kommentare
Image Analyst
am 23 Apr. 2020
Attach your original image of the green 1 on the white background on the black background, and what ever segmentation and resizing code you used.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!