使用Matlab的ocr进行文字识别
Text Recognition using ocr of Matlab
我正在尝试对这张图片进行 OCR-
这就是我使用 ocr
of MATLAB
-
所做的
I=imread('N.jpg');
r = ocr(I,'TextLayout','Word')
但我得到的不是 N
作为 Text
,而是 -
r =
ocrText with properties:
Text: 'I\/
'
CharacterBoundingBoxes: [5x4 double]
CharacterConfidences: [5x1 single]
Words: {'I\/'}
WordBoundingBoxes: [276 120 13 7]
WordConfidences: 0.7718
所以,基本上我得到 I\/
作为 text.How 我可以解决这个问题吗?
您可以使用垂直线结构元素扩大图像,以垂直拉长符号并使其看起来更像 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...
并输出:
r =
ocrText with properties:
Text: 'N
'
CharacterBoundingBoxes: [3x4 double]
CharacterConfidences: [3x1 single]
Words: {'N'}
WordBoundingBoxes: [276 118 13 11]
WordConfidences: 0.8150
耶!
我正在尝试对这张图片进行 OCR-
这就是我使用 ocr
of MATLAB
-
I=imread('N.jpg');
r = ocr(I,'TextLayout','Word')
但我得到的不是 N
作为 Text
,而是 -
r =
ocrText with properties:
Text: 'I\/
'
CharacterBoundingBoxes: [5x4 double]
CharacterConfidences: [5x1 single]
Words: {'I\/'}
WordBoundingBoxes: [276 120 13 7]
WordConfidences: 0.7718
所以,基本上我得到 I\/
作为 text.How 我可以解决这个问题吗?
您可以使用垂直线结构元素扩大图像,以垂直拉长符号并使其看起来更像 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...
并输出:
r =
ocrText with properties:
Text: 'N
'
CharacterBoundingBoxes: [3x4 double]
CharacterConfidences: [3x1 single]
Words: {'N'}
WordBoundingBoxes: [276 118 13 11]
WordConfidences: 0.8150
耶!