OCR different output values

14 ビュー (過去 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 Center および File ExchangeConvert Image Type についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by