MATLAB Answers

How to read the text of an image?

22 views (last 30 days)
Elias Unk
Elias Unk on 22 Sep 2017
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.
With the code and my explanation above the results can easily be replicated

Answers (0)

Community Treasure Hunt

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

Start Hunting!