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:
i have this prblm :ocr requires Computer Vision Toolbox.
Yes, OCR command requires ‘Computer Vision Toolbox’. Same can be validated using the below command in MATLAB:
>> [~,pList] = matlab.codetools.requiredFilesAndProducts(‘ocr.m’);
>> pList.Name
The only workaround would be to use other tools (such as Python, Tesseract, etc.) which provide free libraries for OCR. And then call the respective commands from your MATLAB script and get the results back in the MATLAB environment.