Text Recognition using ocr of Matlab

拜拜、爱过 提交于 2019-12-30 20:27:27

问题


I am trying to do OCR of this image-

This is what I am doing using ocr of MATLAB-

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

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

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 am getting I\/ as text.How can I fix this?


回答1:


You can dilate the image with a vertical line structuring element in order to vertically elongate the symbol and make it somewhat look more like a N.

Eg:

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')

Image:

ahh now it looks like a N...

And output:

r = 

  ocrText with properties:

                      Text: 'N

'
    CharacterBoundingBoxes: [3x4 double]
      CharacterConfidences: [3x1 single]
                     Words: {'N'}
         WordBoundingBoxes: [276 118 13 11]
           WordConfidences: 0.8150

Yay!



来源:https://stackoverflow.com/questions/31030207/text-recognition-using-ocr-of-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!