Borrar filtros
Borrar filtros

Problems with optical character recognition

1 visualización (últimos 30 días)
Trong Link
Trong Link el 11 de Dic. de 2021
Comentada: Trong Link el 13 de Dic. de 2021
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 comentarios
Image Analyst
Image Analyst el 11 de Dic. de 2021
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 el 13 de Dic. de 2021
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.

Iniciar sesión para comentar.

Respuestas (1)

yanqi liu
yanqi liu el 13 de Dic. de 2021
Editada: yanqi liu el 13 de Dic. de 2021
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')

Categorías

Más información sobre Language Support en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by