gusucode.com > MATLAB,车牌定位仿真源码程序 > MATLAB,车牌定位仿真源码程序/programs_and_pictures/dingwei4.m

    function dw4=dingwei4(I)
%功能:对车牌进行第四次分割定位
%实现:利用RGB空间里的蓝色分量

%step1:提取蓝色分量
Iblue=I(:,:,3);%提取蓝色分量
t=graythresh(Iblue);%阈值
Ibluebw=im2bw(Iblue,t);%二值化

%step2:第四次剪切
[PY1,PY2,PX1,PX2]=projection(Ibluebw,50,50,20,20);%坐标重新选取
dw4=I(PY1:PY2,PX1:PX2,:); %剪切图像
imwrite(dw4,'jianqie4.jpg');

figure();
subplot(2,2,1);imshow(I);title('第三次剪切');
subplot(2,2,2);imshow(Iblue);title('提取蓝色分量');
subplot(2,2,3);imshow(Ibluebw);title('二值化');
subplot(2,2,4);imshow(dw4);title('第四次剪切');