matlab提取车牌字符程序,如何用matlab提取和识别车牌数?

我想开发一个matlab程序,可以用模板匹配方法提取和识别车辆的车牌号.

这是我的代码:

function letters = PengenalanPlatMobil(citra)

%load NewTemplates

%global NewTemplates

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

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

citra_filt=medfilt2(citra_bw,[3 3]); % Median filtering to remove noise.

se=strel('disk',1);

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

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

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

imshow(citra_edge_enhacement);

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

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

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

citra_logic=logical(citra_intens); % 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_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);

[labelled jml] = bwlabel(citra_final);

% Uncomment to make compitable with the previous versions of MATLAB®

% Two properties 'BoundingBox' and binary 'Image' corresponding to these

% Bounding boxes are acquired.

Iprops=regionprops(labelled,'BoundingBox','Image');

%%% OCR STEP

[letter{1:jml}]=deal([]);

[gambar{1:jml}]=deal([]);

for ii=1:jml

gambar= Iprops(ii).Image;

letter{ii}=readLetter(gambar);

% imshow(gambar);

%

end

end

但识别出的数字总是错误的,检测到的数量太多或有时太少.

怎么解决?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值