数字图像处理课程设计.doc

上传人:文库蛋蛋多 文档编号:2391671 上传时间:2023-02-17 格式:DOC 页数:14 大小:1.18MB
返回 下载 相关 举报
数字图像处理课程设计.doc_第1页
第1页 / 共14页
数字图像处理课程设计.doc_第2页
第2页 / 共14页
数字图像处理课程设计.doc_第3页
第3页 / 共14页
数字图像处理课程设计.doc_第4页
第4页 / 共14页
数字图像处理课程设计.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《数字图像处理课程设计.doc》由会员分享,可在线阅读,更多相关《数字图像处理课程设计.doc(14页珍藏版)》请在三一办公上搜索。

1、数字图像处理课程设计车牌处理姓名:学号:一、设计目的利用matlab实现车牌识别系统,熟悉matlab应用软件的基础知识,了解了基本程序设计方法,利用其解决数字信号处理的实际应用问题,从而加深对理论知识的掌握,并把所学的知识系统、高效的贯穿到实践中来,避免理论与实践的脱离,巩固理论课上知识的同时,加强实践能力的提高,理论联系实践,提高自身的动手能力。同时不断的调试程序也提高了自己独立编程水平,并在实践中不断完善理论基础,有助于自身综合能力的提高。二、设计的内容学习MATLAB程序设计,利用MATLAB函数功能,设计和实现通过设计一个车牌识别系统。车牌识别系统的基本工作原理为:将手机拍摄到的包含

2、车辆牌照的图像输入到计算机中进行预处理,再对牌照进行搜索、检测、定位,并分割出包含牌照字符的矩形区域,然后对牌照字符进行二值化并将其分割为单个字符,然后将其逐个与创建的字符模板中的字符进行匹配,匹配成功则输出,最终匹配结束则输出则为车牌号码的数字。三、程序代码clear all;close all;clc;Ic,map=imread(E:car.jpg);figure;imshow(Ic);title(图1 彩色车牌);Igray=rgb2gray(Ic);figure;imshow(Igray);title(图2 灰度车牌);I2bw=im2bw(Igray,0.3);figure;imsh

3、ow(I2bw);title(图3 二值图像); BW=edge(Igray,sobel);figure;imshow(BW);title(图4 边沿检测); msk=0 0 0 0 0; 0 1 1 1 0; 0 1 1 1 0; 0 1 1 1 0; 0 0 0 0 0;B0=conv2(double(BW),double(msk);figure;imshow(B0);title(图5 边沿增强);se=ones(2,50);B1=imdilate(B0,se);figure;imshow(B1);title(图6 第一次膨胀);B2=imerode(B1,se);figure;imsho

4、w(B2);title(图7 第一次腐蚀);se=ones(15,2);B3=imdilate(B2,se);figure;imshow(B3);title(图8 第二次膨胀);B4=imerode(B3,se);figure;imshow(B4);title(图9 第二次腐蚀);se=ones(10,2);B5=imdilate(B4,se);figure;imshow(B5);title(图10 第三次膨胀);B6=imerode(B5,se);figure;imshow(B6);title(图11 第三次腐蚀); B,L=bwboundaries(B6,4); figure; imsho

5、w(label2rgb(L,jet,.5 .5 .5); hold on for k=1;length(B) boundary=Bk; plot(boundary(:,2),boundary(:,1),w,LineWidth,2) end stats=regionprops(L,Area,Centroid); for k=1:length(B) boundary=Bk; delta_sq=diff(boundary).2; perimeter=sum(sqrt(sum(delta_sq,2); area=stats(k).Area; metric=27*area/perimeter2; met

6、ric_string=sprintf(%2.2f,metric); if metric=0.85&metric1000 centroid=stats(k).Centroid; plot(centroid(1),centroid(2),ko); goalboundary=boundary; s=min(goalboundary,1); e=max(goalboundary,1); goal=imcrop(I2bw,s(2) s(1) e(2)-s(2) e(1)-s(1); end text(boundary(1,2)-35,boundary(1,1)+13,metric_string,Colo

7、r,g,FontSize,14,Fontweight,bold); end goal=goal; figure; imshow(goal); title(检测出的车牌); %车牌识别%裁剪goal=my_imtrim(goal);figure;imshow(goal); title(裁剪后的车牌区域);%分割w1,w2,w3,w4,w5,w6=my_cut(goal);figure;subplot(2,6,1); imshow(w1);subplot(2,6,2); imshow(w2);subplot(2,6,3); imshow(w3);subplot(2,6,4); imshow(w4)

8、;subplot(2,6,5); imshow(w5);subplot(2,6,6); imshow(w6);w1,w2,w3,w4,w5,w6=my_norm(w1,w2,w3,w4,w5,w6,40,20);subplot(2,6,7); imshow(w1);subplot(2,6,8); imshow(w2);subplot(2,6,9); imshow(w3);subplot(2,6,10); imshow(w4);subplot(2,6,11); imshow(w5);subplot(2,6,12); imshow(w6);% fname=strcat(D:std_test_ima

9、gesphoto,D,.jpg);% t1,map=imread(fname);% fname=strcat(D:std_test_imagesphoto,O,.jpg);% t2,map=imread(fname);% corr2(w2,t1),corr2(w2,t2)lcode=char(A:Z,unknown);temp=;w=w1,w2,w3,w4,w5,w6;for k=1:26 fname=strcat(E:photo,lcode(k),.jpg); t,map=imread(fname); temp=temp,t;endnum=strcat(车牌号为:);for i=1:6 sa

10、mple=w(:,20*(i-1)+1:20*(i-1)+20); flag=27; rel=-1; for j=1:26 templet=temp(:,20*(j-1)+1:20*(j-1)+20); if corr2(templet,sample)rel rel=corr2(templet,sample); flag=j; end end num=strcat(num,32,lcode(flag);endnum figureimshow(Ic)title(num) function word,result=getword(d)word=;flag=0;y1=8;y2=0.5;while f

11、lag=0 m,n=size(d); wide=0;while sum(d(:,wide+1)=0&wide=n-2 wide=wide+1;endtemp=qiege(imcrop(d,1 1 wide m);m1,n1=size(temp);if widey2 d(:,1:wide)=0; if sum(sum(d)=0 d=qiege(d);%切割出最小范围? else word=; flag=1; endelse word=qiege(imcrop(d,1 1 wide m); d(:,1:wide)=0; if sum(sum(d)=0 d=qiege(d); flag=1; els

12、e d=; endendendresult=d;function w1,w2,w3,w4,w5,w6 = my_cut( im )%将裁剪后的图像分割为6个字符% 提取第一个字符m,n=size(im);left=1;right=1;while sum(im(:,right)0 & rightn right=right+1;endw1=imcrop(im,left,1,right-left-1,m);% 提取第二个字符while sum(im(:,right)=0 & right0 & rightn right=right+1;endw2=imcrop(im,left,1,right-left

13、-1,m);% 提取第三个字符while sum(im(:,right)=0 & right0 & rightn right=right+1;endw3=imcrop(im,left,1,right-left-1,m);% 提取第四个字符while sum(im(:,right)=0 & right0 & rightn right=right+1;endw4=imcrop(im,left,1,right-left-1,m);% 提取第五个字符while sum(im(:,right)=0 & right0 & rightn right=right+1;endw5=imcrop(im,left,

14、1,right-left-1,m);% 提取第六个字符while sum(im(:,right)=0 & right0 & rightm/5 & leftm/5 & right1 right=right-1;endim=imcrop(im,left 1 right-left m);% 第二次裁剪m,n=size(im);top=1;bottom=m;while sum(im(top,:)0 & top0 & bottom1 bottom=bottom-1;endim=imcrop(im,1 top n bottom-top);% 第三次裁剪m,n=size(im);top=1;bottom=m

15、;left=1;right=n;while sum(im(top,:)=0 & top1 bottom=bottom-1;endwhile sum(im(:,left)=0 & left1 right=right-1;endgoal=imcrop(im,left,top,right-left,bottom-top);endfunction w1,w2,w3,w4,w5,w6 = my_norm(w1,w2,w3,w4,w5,w6,x)%将提取出的字符统一大小w1=imresize(w1,x);w2=imresize(w2,x);w3=imresize(w3,x);w4=imresize(w4,x);w5=imresize(w5,x);w6=imresize(w6,x);end四、设计结果五、心得体会通过这次课程设计,让我又一次了解和熟悉了MATLAB这个强大的处理工具,这次课程设计虽然初期由于自己基础不扎实,在设计实现过程中遇到了很多麻烦和问题,花了很多不必要的时间,好在自己还是坚持了下来,积极想办法解决问题,没有放弃,最终才能做到这个地步,有一点小小的成就感。同时也明白了做什么事尤其是科研,专注和坚持是很重要的。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号