Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit:

reading letters using OCR

Asked by Pat on 15 Feb 2013

I have a image in want to read the letters,but those letters are not read it shows just one letter,plz tell how to read it using ocr

my inage


Pat on 15 Feb 2013

my cropped portion of image,Gt8XDJG

Walter Roberson on 15 Feb 2013

Which is the original? The green one or the gray one?

Pat on 15 Feb 2013

the green one is original,i had converted to gray scale and processed it



2 Answers

Answer by Walter Roberson on 15 Feb 2013

Instead of converting to grayscale, threshold on the green channel.

1 Comment

Pat on 15 Feb 2013
Walter i did as following even though text is not clear 
clear all
close all
Rchannel = K(:,:,1);
Gchannel = K(:,:,2);
Bchannel = K(:,:,3);
Map = Gchannel>thresh; 
 u= bsxfun(@times,K,uint8(Map)); %apply map to whole image
Walter Roberson
Answer by Image Analyst on 15 Feb 2013

Those are very crude letters. It will probably take a pretty sophisticated OCR routine to recognize those. This MATLAB forum does not go into OCR much, except to refer you to the File Exchange or a web search. But you'll have trouble finding any OCR that can recognize those letters. You'd need substantial processing to turn them into something a lot more recognizable, and we just don't get into that kind of complicated algorithm development here. About all I could suggest is to use something like imclose() and bwmorph() to try to morph them into something that looks more like normal letters.

1 Comment

Pat on 18 Feb 2013
MY code so far 
clear all
close all
% bw = im2bw(J,graythresh(K))
se = strel('disk',5);
closeBW = imclose(bw,se);
figure, imshow(closeBW)
BW2 = bwmorph(closeBW,'thicken');
figure, imshow(BW2)
BW3 = bwmorph(BW2,'spur');
figure, imshow(BW3)
se1 = strel('square',8) 
closeBW1 = imclose(BW3 ,se1);
figure, imshow(closeBW1)

is there still more way ti read those letters as normal one,pleas eassist

Image Analyst

Contact us