2

我想对车牌中的字符进行分割,并通过模板匹配进行识别。
但是在我在图像处理中做了一些基本步骤之后,输出图像有一个边框,所以这个边框被检测为另一个字符。
怎么解决??

这是我的代码:

% Resizing the image keeping aspect ratio same.
citra=imresize(citra,[400 NaN]);

% Converting the RGB (color) image to gray (intensity).
citra_bw=rgb2gray(citra);

citra_bw= imclearborder(citra_bw);
imshow(citra_bw);

% Median filtering to remove noise.
citra_filt=medfilt2(citra_bw,[5 5]); 
se=strel('disk',3);

% Dilating the gray image with the structural element.
citra_dilasi=imdilate(citra_filt,se); 

% Eroding the gray image with structural element.
citra_eroding=imerode(citra_filt,se);

% Morphological Gradient for edges enhancement.
citra_edge_enhacement=imsubtract(citra_dilasi,citra_eroding); 

imshow(citra_edge_enhacement);

% Converting the class to double.
citra_edge_enhacement_double=mat2gray(double(citra_edge_enhacement)); 

% Convolution of the double image f
citra_double_konv=conv2(citra_edge_enhacement_double,[1 1;1 1]); 

% Intensity scaling between the range 0 to 1.
citra_intens=imadjust(citra_double_konv,[0.5 0.7],[0 1],0.1); 

% Conversion of the class from double to binary.
% Eliminating the possible horizontal lines 
% from the output image of regiongrow
% that could be edges of license plate.
citra_logic=logical(citra_intens);  


citra_line_delete=imsubtract(citra_logic,(imerode(citra_logic,...
                                                  strel('line',50,0))));

% Filling all the regions of the image.
citra_fill=imfill(citra_line_delete,'holes');

% Thinning the image to ensure character isolation.         
citra_thinning_eroding=imerode((bwmorph(citra_fill,'thin',1)),...
                               (strel('line',3,90)));

%Selecting all the regions that are of pixel area more than 100.
citra_final=bwareaopen(citra_thinning_eroding,125);
imshow(citra_final);

这是原始图像:

原始图像
(来源:plateshack.com

这是处理后的图像,字符中有边框

处理后的图像,字符中有边框

4

1 回答 1

0

首先,我不确定您的算法是否真的经过优化。它似乎很复杂,但不适合您的问题。

我会简单地尝试二值化(不使用“逻辑”命令),然后使用 imerode 和 bwareaopen 来摆脱角色周围的小东西。这应该比您的代码更简单...

于 2013-08-14T21:21:48.563 回答