OCR different output values

12 次查看(过去 30 天)
Highscore
Highscore 2020-4-23
评论: Highscore 2020-4-23
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 个评论
Image Analyst
Image Analyst 2020-4-23
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.
Highscore
Highscore 2020-4-23
I edited my first post!

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by