OCR different output values
조회 수: 13 (최근 30일)
이전 댓글 표시
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
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.
답변 (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!