使用Matlab的ocr进行文本识别 [英] Text Recognition using ocr of Matlab
本文介绍了使用Matlab的ocr进行文本识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试对此图片执行OCR -
I am trying to do OCR of this image-
我正在使用 ocr
MATLAB
-
This is what I am doing using ocr
of MATLAB
-
I=imread('N.jpg');
r = ocr(I,'TextLayout','Word')
但不是得到 N
as Text
这就是我得到的 -
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
所以,基本上我得到 I \ /
as text。如何解决这个问题?
So,basically I am getting I\/
as text.How can I fix this?
推荐答案
您可以使用垂直线结构元素按顺序扩展图像垂直拉长符号并使其看起来更像是N.
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.
例如:
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')
图片:
啊现在看起来像是N ...
ahh now it looks like a N...
输出:
r =
ocrText with properties:
Text: 'N
'
CharacterBoundingBoxes: [3x4 double]
CharacterConfidences: [3x1 single]
Words: {'N'}
WordBoundingBoxes: [276 118 13 11]
WordConfidences: 0.8150
Yay!
这篇关于使用Matlab的ocr进行文本识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文