Clear Filters
Clear Filters

Need to find the digit of this image

5 views (last 30 days)
Abdur Rob
Abdur Rob on 6 Mar 2023
Answered: Sarvesh Kale on 6 Mar 2023
I want to extract the number from this image. I used ocr technique to extract the number but could not get the appropriate result. As being new user of matlab, Don't understand how to solve my problem.
Here is my attemps
I = imread("mm.jpg");
ocrResults = ocr(I,Language="seven-segment");
and The ERROR
Error using vision.internal.ocr.validateLanguage
Invalid language character vector. Display valid language character vectors.
Error in ocr>checkLanguage (line 312)
lang = vision.internal.ocr.validateLanguage(modifiedLang, vision.internal.ocr.ocrSpkgInstalled());
Error in ocr>parseInputs (line 224)
[validLanguage, isCustomLanguage] = checkLanguage(userInput.Language);
Error in ocr (line 119)
[roi, hasROI, params] = parseInputs(I,varargin{:});

Answers (1)

Sarvesh Kale
Sarvesh Kale on 6 Mar 2023
You can try the following code snippet for detecting digits in image
img = imread('mm.jpeg'); % your image path
ocr_result = ocr(img,[125.5 103.5 87 39],Language="seven-segment"); % this gives the co-ordinates of the bounding box around the digits
% i got the roi values by using the imcrop function
ocr_result.Words % displays the text detected
Iocr = insertObjectAnnotation(i,"rectangle",...
ocr_result.WordBoundingBoxes,ocr_result.Words,LineWidth=5,fontsize=18);
figure ;
imshow(Iocr)
More information on ocr can be found at the following documentation https://in.mathworks.com/help/vision/ref/ocr.html
I hope this helps your query
Thank you

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!