How to read numbers from an image in matlab using ocr (optical character recognition)?

This video shows how one can use OCR from Computer Vision toolbox of Matlab to easily read numbers or digits from an image.

It further shows how we can superimpose a rectangle over the boundaries of the text part identified by the OCR in the image.

I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com

Complete source code and other details:

I = imread('number.png');
ocrOutput = ocr(I, 'TextLayout', 'Line', 'characterSet', '0123456789');
outputNum = str2double(ocrOutput.Text)
ocrImage = insertObjectAnnotation(I, 'rectangle', ocrOutput.WordBoundingBoxes, ...
    ocrOutput.WordConfidences);
imshow(ocrImage);

The images used in demo are posted below:

Leave a Reply