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

Published: 24 April 2022
on channel: Programmer World
5,377
40

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: [email protected]

Complete source code and other details of this video are posted in the below link:
https://programmerworld.co/matlab/how...


However, the main code is copied below also for reference:


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);



-