<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/625d005992dc900e6269f311/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/625d005992dc900e6269f311/bg1.jpg"><div class="c x0 y1 w2 h2"><div class="t m0 x1 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">clear;</div><div class="t m0 x1 h3 y3 ff1 fs0 fc0 sc0 ls0 ws0">[A,map]=imread('F:/boy<span class="_ _0"></span>.jpg');</div><div class="t m0 x1 h4 y4 ff1 fs0 fc0 sc0 ls0 ws0">X=rgb2gr<span class="_ _1"></span>ay(<span class="_ _1"></span>A); %<span class="ff2">画出原始图像 </span></div><div class="t m0 x1 h4 y5 ff1 fs0 fc0 sc0 ls0 ws0">subplot(2,2,1);imshow(X);&tle('<span class="ff2">原始图像</span>'); %<span class="ff2">产生含噪图像 </span></div><div class="t m0 x1 h4 y6 ff1 fs0 fc0 sc0 ls0 ws0">x=imnoise(X ,'gaussian',0,0.003);%<span class="ff2">画出含噪图像 </span></div><div class="t m0 x1 h4 y7 ff1 fs0 fc0 sc0 ls0 ws0">subplot(2,2,2);imshow(x); &tle('<span class="ff2">含噪声图像</span>'); </div><div class="t m0 x1 h4 y8 ff1 fs0 fc0 sc0 ls0 ws0">%<span class="ff2">下面进行图像的去噪处理 </span></div><div class="t m0 x1 h4 y9 ff1 fs0 fc0 sc0 ls0 ws0">%<span class="ff2">用小波函数<span class="_ _2"> </span></span>sym4<span class="_ _2"> </span><span class="ff2">对<span class="_ _2"> </span></span>x<span class="_ _2"> </span><span class="ff2">进行<span class="_ _2"> </span></span>2<span class="_ _2"> </span><span class="ff2">层小波分解 </span></div><div class="t m0 x1 h3 ya ff1 fs0 fc0 sc0 ls0 ws0">[c,s]=wav<span class="_ _1"></span>edec2(x,2,'sym4'); </div><div class="t m0 x1 h4 yb ff1 fs0 fc0 sc0 ls0 ws0">%<span class="ff2">提取小波分解中第一层的低频图像,即实现了低通滤波去噪 </span></div><div class="t m0 x1 h4 yc ff1 fs0 fc0 sc0 ls0 ws0">a1=wrcoe<span class="_ _1"></span>f2('a',c,s,'sym4'); % a1<span class="_ _2"> </span><span class="ff2">为 </span>double <span class="ff2">型数据;</span>%<span class="ff2">画出去噪后的图像 </span></div><div class="t m0 x1 h4 yd ff1 fs0 fc0 sc0 ls0 ws0">subplot(2,2,3); <span class="_ _3"></span>imshow(uint8(a1)); % <span class="_ _3"></span><span class="ff2">注<span class="_ _3"></span>意 <span class="_ _3"></span></span>imshow()<span class="_ _3"></span><span class="ff2">和<span class="_ _2"> </span></span>image()<span class="_ _3"></span><span class="ff2">显示<span class="_ _3"></span>图像<span class="_ _3"></span>有<span class="_ _3"></span>区别<span class="_ _3"></span>,</span>imshow()<span class="_ _3"></span><span class="ff2">不<span class="_ _3"></span>能</span></div><div class="t m0 x1 h4 ye ff2 fs0 fc0 sc0 ls0 ws0">显示 <span class="ff1">double </span>型数据,必须进行转换 <span class="ff1">uint8(a1)</span>;</div><div class="t m0 x1 h4 yf ff1 fs0 fc0 sc0 ls0 ws0">&tle('<span class="ff2">第一次去噪图像</span>'); </div><div class="t m0 x1 h4 y10 ff1 fs0 fc0 sc0 ls0 ws0">% <span class="ff2">并且<span class="_ _2"> </span></span>image() <span class="ff2">显示图像有坐标;</span></div><div class="t m0 x1 h4 y11 ff1 fs0 fc0 sc0 ls0 ws0">%<span class="ff2">提取小波分解中第二层的低频图像,即实现了低通滤波去噪 </span></div><div class="t m0 x1 h4 y12 ff1 fs0 fc0 sc0 ls0 ws0">%<span class="ff2">相当于把第一层的低频图像经过再一次的低频滤波处理 </span></div><div class="t m0 x1 h4 y13 ff1 fs0 fc0 sc0 ls0 ws0">a2=wrcoe<span class="_ _1"></span>f2('a',c,s,'sym4',2); %<span class="ff2">画出去噪后的图像 </span></div><div class="t m0 x1 h3 y14 ff1 fs0 fc0 sc0 ls0 ws0">subplot(2,2,4); imshow(uint8(a2)); </div><div class="t m0 x1 h3 y15 ff1 fs0 fc0 sc0 ls0 ws0">%image(a2);</div><div class="t m0 x1 h4 y16 ff1 fs0 fc0 sc0 ls0 ws0">&tle('<span class="ff2">第二次去噪图像</span>');</div><div class="t m0 x1 h4 y17 ff1 fs0 fc0 sc0 ls0 ws0">%<span class="ff2">保存图像 </span></div><div class="t m0 x1 h3 y18 ff1 fs0 fc0 sc0 ls0 ws0">% imwrite(x,'2.jpg');</div><div class="t m0 x1 h3 y19 ff1 fs0 fc0 sc0 ls0 ws0">% imwrite(uin<span class="_ _1"></span>t8(a1),'3.jpg'); </div><div class="t m0 x1 h4 y1a ff1 fs0 fc0 sc0 ls0 ws0">%imwrite()<span class="ff2">保存图像,也需要将数据类型转化为<span class="_ _2"> </span></span>uin<span class="_ _1"></span>t8</div><div class="t m0 x1 h3 y1b ff1 fs0 fc0 sc0 ls0 ws0">% imwrite(uin<span class="_ _1"></span>t8(a2),'4.jpg')</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>