필터 지우기
필터 지우기

Problems with optical character recognition

조회 수: 1 (최근 30일)
Trong Link
Trong Link 2021년 12월 11일
댓글: Trong Link 2021년 12월 13일
I am implementing an automatic graph image digitizer. I'm trying to determine the labels on the axes, I use the built-in function ocr() to determine them. It can initially determine the exact values if the x and y axes are linear scales. But if the axes are logarithmic scale then the ocr() function cannot determine the exact logarithmic values on each axis. Is there any way I can get those logarithmic values?
Here is the images that I cropped from my input graph image:
How can the logarithmic values be determined on those images?
  댓글 수: 2
Image Analyst
Image Analyst 2021년 12월 11일
What does your ocr() give? Like 107, 106, 105, etc. If so you'll just have to recognize that the third number is the power of ten.
Trong Link
Trong Link 2021년 12월 13일
I can do so if I know the axes are logarithmic scale. I'm assuming my digitizer doesn't know what scale the axes are, linear or logarithmic.

댓글을 달려면 로그인하십시오.

답변 (1개)

yanqi liu
yanqi liu 2021년 12월 13일
편집: yanqi liu 2021년 12월 13일
yes,sir,if we can get the figure or .fig file,may be use figure handle can get the property value
but,if just image,it is an digits ocr problem,the logarithmic data type may be use the height to classify between normal digits、logarithmic digits
when get the class,use image segment to get the number list,and make the right number or the small height number as exponential number
here is an example
clc; clear all; close all;
img = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/830925/image.png');
img = rgb2gray(img);
bw = imbinarize(img,'adaptive','ForegroundPolarity','dark','Sensitivity',0.4);
bw2 = imdilate(imclose(~bw, strel('square', 7)), strel('square', 7));
stats = regionprops(bw2);
rect1 = stats(1).BoundingBox;
bwi = imcrop(bw, round(rect1));
bwi = imresize(bwi, 40/size(bwi,1), 'bilinear');
statsi = regionprops(~bwi);
ocrResults=ocr(bwi,'CharacterSet','0123456789')
ocrResults =
ocrText with properties: Text: '107↵↵' CharacterBoundingBoxes: [5×4 double] CharacterConfidences: [5×1 single] Words: {'107'} WordBoundingBoxes: [8 8 40 24] WordConfidences: 0.6906
str = strtrim(ocrResults.Text)
str = '107'
rectsi = cat(1, statsi.BoundingBox);
rectsi = sortrows(rectsi, 1);
if rectsi(end, 4)/rectsi(1, 4) < 0.8
% the right number height
str = [str(1:end-1) '^' str(end)];
end
str
str = '10^7'
figure; imshow(img, [])
hold on; rectangle('position', rect1, 'EdgeColor', 'g', 'LineWidth', 2)
text(rect1(1), rect1(2), str, 'color', 'r')

카테고리

Help CenterFile Exchange에서 Language Support에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by