Recognizing text using ocr from Matlab

I'm trying to make an OCR of this image -

enter image description here

This is what I do using ocr of MATLAB -

 I=imread('N.jpg'); r = ocr(I,'TextLayout','Word') 

But instead of getting N as Text this is what I get -

 r = ocrText with properties: Text: 'I\/ ' CharacterBoundingBoxes: [5x4 double] CharacterConfidences: [5x1 single] Words: {'I\/'} WordBoundingBoxes: [276 120 13 7] WordConfidences: 0.7718 

So basically I get I\/ as text. How can i fix this?

+7
image-processing matlab ocr matlab-cvst
source share
1 answer

You can expand the image using the vertical line structure element to vertically lengthen the character and make it somewhat more like N.

For example:

 clear clc I=imread('N.jpg'); %// Line oriented at 90 degrees. SE = strel('line',4,90); I = imdilate(I,SE); imshow(I) r = ocr(I,'TextLayout','Word') 

Picture

enter image description here

ahh now it looks like n ...

And the conclusion:

 r = ocrText with properties: Text: 'N ' CharacterBoundingBoxes: [3x4 double] CharacterConfidences: [3x1 single] Words: {'N'} WordBoundingBoxes: [276 118 13 11] WordConfidences: 0.8150 

Yay

+5
source share

All Articles