下载后可任意编辑基于Matlab的车牌定位与分割经典算法I=imread('car
jpg'); %读取图像figure(); subplot(3,2,1),imshow(I), title('原始图像');I1=rgb2gray(I);%转化为灰度图像subplot(3,2,2),imshow(I1),title('灰度图像');I2=edge(I1,'robert',0
09,'both');%采纳robert算子进行边缘检测subplot(3,2,3),imshow(I2),title('边缘检测后图像');下载后可任意编辑se=[1;1;1]; %线型结构元素 I3=imerode(I2,se); %腐蚀图像subplot(3,2,4),imshow(I3),title('腐蚀后边缘图像');se=strel('rectangle',[25,25]); 矩形结构元素I4=imclose(I3,se);%图像聚类、填充图像subplot(3,2,5),imshow(I4),title('填充后图像');下载后可任意编辑I5=bwareaopen(I4,2000);%去除聚团灰度值小于2000的部分subplot(3,2,6),imshow(I5),title('形态滤波后图像');[y,x,z]=size(I5);I6=double(I5); Y1=zeros(y,1); for i=1:y for j=1:x下载后可任意编辑 if(I6(i,j,1)==1) Y1(i,1)= Y1(i,1)+1; end end end [temp MaxY]=max(Y1); fig