MATLAB: How to import a table containing numbers in a picture with OCR

image analysisMATLABnumbersocr

I have a picture of a table with numeric data in it. Like this:
example.JPG
How do I import the values with ocr? Is there a better method?
I tried to use ocr, but it's not working properly.
Thank you

Best Answer

Try resizing the image. It would hopefully improve the accuracy.
a = imread('image.jpeg');
a = imresize(a,2);
txt = ocr(a,'CharacterSet','0123456789.');
Iocr = insertObjectAnnotation(a, 'rectangle', ...
txt.WordBoundingBoxes, ...
txt.WordConfidences);
for i = 1:length(txt.Words)
Iocr = insertText(Iocr,txt.WordBoundingBoxes(i,1:2),txt.Words{i},'AnchorPoint','Center');
end
figure; imshow(Iocr);