How to read the text of an image?
10 次查看(过去 30 天)
显示 更早的评论
Trying to set a text reading algorithm.It should be able to read the words and numbers (handwriting excluded), however, the text can be in a spiral shape, angel, different backgrounds and so forth so basically it should be a standard way and not targeting any precise pattern. I did write the following code :
clc,clear all;
[fname, path]=uigetfile('*png','Select an Image');
fname = strcat(path,fname);
img=imread(fname);
imshow(img);
text=ocr(img);
Box = insertObjectAnnotation(img, 'rectangle',...
text.WordBoundingBoxes,...
text.WordConfidences);
imshow(Box);
The image basically undergoes an analysis using ocr to get the words than using insertObjectAnnotation I draw a box around each and every word with an accuracy percentage between 0 and 1, the closest to 1 the better, the way words are seen can be checked going to workspace then text then words.The issue is I'm getting really bad result outcome with a fail to get the correct words more often than not.Note also that I did check Matlab's documentation and examples in computer vision system toolbox but it wasn't really helpful. What I want is mainly improving the accuracy of my results.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167432/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167434/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167436/image.png)
With the code and my explanation above the results can easily be replicated
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!