<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="generator" content="pdf2htmlEX">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="https://static.pudn.com/base/css/base.min.css">
<link rel="stylesheet" href="https://static.pudn.com/base/css/fancy.min.css">
<link rel="stylesheet" href="https://static.pudn.com/prod/directory_preview_static/626769224c65f412596a5184/raw.css">
<script src="https://static.pudn.com/base/js/compatibility.min.js"></script>
<script src="https://static.pudn.com/base/js/pdf2htmlEX.min.js"></script>
<script>
try{
pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({});
}catch(e){}
</script>
<title></title>
</head>
<body>
<div id="sidebar" style="display: none">
<div id="outline">
</div>
</div>
<div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://static.pudn.com/prod/directory_preview_static/626769224c65f412596a5184/bg1.jpg"><div class="c x0 y1 w2 h2"><div class="t m0 x1 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">clc</div><div class="t m0 x1 h3 y3 ff1 fs0 fc0 sc0 ls0 ws0">clear</div><div class="t m0 x1 h3 y4 ff1 fs0 fc0 sc0 ls0 ws0">close all</div><div class="t m0 x1 h3 y5 ff1 fs0 fc0 sc0 ls0 ws0">I=imread('chepai.jpg');</div><div class="t m0 x1 h4 y6 ff1 fs0 fc0 sc0 ls0 ws0">subplot(3,2,1);imshow(I), title('<span class="ff2">原始图像</span>');</div><div class="t m0 x1 h3 y7 ff1 fs0 fc0 sc0 ls0 ws0">I_gray=rgb2gr<span class="_ _0"></span>ay(I);</div><div class="t m0 x1 h4 y8 ff1 fs0 fc0 sc0 ls0 ws0">subplot(3,2,2),imshow(I_gray),title('<span class="ff2">灰度图像</span>');</div><div class="t m0 x1 h4 y9 ff1 fs0 fc1 sc0 ls0 ws0">%====================<span class="_ _1"></span>== <span class="ff2">形态学预处理</span> ============<span class="_ _1"></span>==========</div><div class="t m0 x1 h3 ya ff1 fs0 fc0 sc0 ls0 ws0">I_edge=edge(I_gray<span class="_ _2"></span>,'sobel');</div><div class="t m0 x1 h4 yb ff1 fs0 fc0 sc0 ls0 ws0">subplot(3,2,3),imshow(I_edge),title('<span class="ff2">边缘检测后图像</span>');</div><div class="t m0 x1 h3 yc ff1 fs0 fc0 sc0 ls0 ws0">se=[1;1;1]; </div><div class="t m0 x1 h3 yd ff1 fs0 fc0 sc0 ls0 ws0">I_erode=imerode(I_edge,se); </div><div class="t m0 x1 h4 ye ff1 fs0 fc0 sc0 ls0 ws0">subplot(3,2,4),imshow(I_erode),title('<span class="ff2">腐蚀后边缘图像</span>');</div><div class="t m0 x1 h3 yf ff1 fs0 fc0 sc0 ls0 ws0">se=strel('rectangle',[25,25]); </div><div class="t m0 x1 h4 y10 ff1 fs0 fc0 sc0 ls0 ws0">I_close=imclose(I_erode,se); <span class="fc1">%<span class="ff2">图像闭合、填充图像</span></span></div><div class="t m0 x1 h4 y11 ff1 fs0 fc0 sc0 ls0 ws0">subplot(3,2,5),imshow(I_close),title('<span class="ff2">填充后图像</span>');</div><div class="t m0 x1 h4 y12 ff1 fs0 fc0 sc0 ls0 ws0">I_final=bwareaopen(I_close,2000); <span class="fc1">%<span class="ff2">去除聚团灰度值小于<span class="_ _3"> </span></span>2000<span class="_ _3"> </span><span class="ff2">的部分</span></span></div><div class="t m0 x1 h4 y13 ff1 fs0 fc0 sc0 ls0 ws0">subplot(3,2,6),imshow(I_final),title('<span class="ff2">形态滤波后图像</span>');</div><div class="t m0 x1 h4 y14 ff1 fs0 fc1 sc0 ls0 ws0">%====================<span class="_ _1"></span>====== <span class="ff2">车牌分割</span> ==========<span class="_ _1"></span>===================</div><div class="t m0 x1 h3 y15 ff1 fs0 fc0 sc0 ls0 ws0">I_new=zeros(size(I_final,1),size(I_final,2));</div><div class="t m0 x1 h3 y16 ff1 fs0 fc0 sc0 ls0 ws0">location_of_1=[];</div><div class="t m0 x1 h4 y17 ff1 fs0 fc0 sc0 ls0 ws0">for i=1:size(I_final,1) %<span class="ff2">寻找二值图像中白的点的位置</span></div><div class="t m0 x1 h3 y18 ff1 fs0 fc0 sc0 ls0 ws0"> for j=1:size(I_final,2)</div><div class="t m0 x1 h3 y19 ff1 fs0 fc0 sc0 ls0 ws0"> if I_final(i,j)==1;</div><div class="t m0 x1 h3 y1a ff1 fs0 fc0 sc0 ls0 ws0"> newlocation=[i,j];</div><div class="t m0 x1 h3 y1b ff1 fs0 fc0 sc0 ls0 ws0"> location_of_1=[location_of_1;newlocation]; </div><div class="t m0 x1 h3 y1c ff1 fs0 fc0 sc0 ls0 ws0"> end</div><div class="t m0 x1 h3 y1d ff1 fs0 fc0 sc0 ls0 ws0"> end</div><div class="t m0 x1 h3 y1e ff1 fs0 fc0 sc0 ls0 ws0">end</div><div class="t m0 x1 h3 y1f ff1 fs0 fc0 sc0 ls0 ws0">mini=inf;maxi=0;</div><div class="t m0 x1 h3 y20 ff1 fs0 fc0 sc0 ls0 ws0">for i=1:size(location_of_1,1)</div><div class="t m0 x1 h4 y21 ff1 fs0 fc1 sc0 ls0 ws0">%<span class="ff2">寻找所有白点中,</span>x<span class="_ _3"> </span><span class="ff2">坐标与<span class="_ _3"> </span></span>y<span class="_ _4"> </span><span class="ff2">坐标的和最大,最小的两个点的位置</span></div><div class="t m0 x1 h3 y22 ff1 fs0 fc0 sc0 ls0 ws0"> temp=location_of_1(i,1)+location_of_1(i,2);</div><div class="t m0 x1 h3 y23 ff1 fs0 fc0 sc0 ls0 ws0"> if temp<mini</div><div class="t m0 x1 h3 y24 ff1 fs0 fc0 sc0 ls0 ws0"> mini=temp;</div><div class="t m0 x1 h3 y25 ff1 fs0 fc0 sc0 ls0 ws0"> a=i;</div><div class="t m0 x1 h3 y26 ff1 fs0 fc0 sc0 ls0 ws0"> end</div><div class="t m0 x1 h3 y27 ff1 fs0 fc0 sc0 ls0 ws0"> if temp>maxi</div><div class="t m0 x1 h3 y28 ff1 fs0 fc0 sc0 ls0 ws0"> maxi=temp;</div><div class="t m0 x1 h3 y29 ff1 fs0 fc0 sc0 ls0 ws0"> b=i;</div></div></div><div class="pi" data-data='{"ctm":[1.611850,0.000000,0.000000,1.611850,0.000000,0.000000]}'></div></div>
</body>
</html>