Need to find the digit of this image
8 views (last 30 days)
Show older comments
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1315485/image.jpeg)
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{:});
0 Comments
Answers (1)
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
0 Comments
See Also
Categories
Find more on Read, Write, and Modify Image in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!