⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chap03.htm

📁 数字图像处理入门. 一位图像处理高手写的书. 从图像处理的最基础开始,然后慢慢以一些例子做说明,进入图像处理的更高阶段.学习图像处理不可多得的比较朴实的书
💻 HTM
📖 第 1 页 / 共 5 页
字号:
lang=EN-US>4</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>×</span><span lang=EN-US>(9</span><span
style='font-family:宋体;"Times New Roman"'>个乘法,</span><span lang=EN-US>8</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>个加法,</span><span
lang=EN-US>1</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>个除法</span><span lang=EN-US>)</span><span
style='font-family:宋体;"Times New Roman"'>,共</span><span lang=EN-US>36</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>个乘法,</span><span
lang=EN-US>32</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>个加法,</span><span lang=EN-US>4</span><span
style='font-family:宋体;"Times New Roman"'>个除法;后者做了</span><span lang=EN-US>4</span><span
style='font-family:宋体;"Times New Roman"'>×</span><span lang=EN-US>(3</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>个乘法,</span><span
lang=EN-US>2</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>个加法</span><span lang=EN-US>)+4</span><span
style='font-family:宋体;"Times New Roman"'>×</span><span lang=EN-US>(3</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>个乘法,</span><span
lang=EN-US>2</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>个加法</span><span lang=EN-US>)+4</span><span
style='font-family:宋体;"Times New Roman"'>个除法,共</span><span lang=EN-US>24</span><span
style='font-family:宋体;"Times New Roman"'>个乘法,</span><span lang=EN-US>16</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>个加法,</span><span
lang=EN-US>4</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>个除法,运算简化了不少,如果是大图,效率的提高将是非常客观的。</span></p>
  <p style='line-height:18.0pt'><span
style='font-family:宋体;"Times New Roman"'>平滑模板的思想是通过将一点和周围</span><span lang=EN-US>8</span><span
style='font-family:宋体;"Times New Roman"'>个点作平均,从而去除突然变化的点,滤掉噪声,其代价是图象有一定程度的模糊。上面提到的模板</span><span
lang=EN-US>(3.1)</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>,就是一种平滑模板,称之为</span><span lang=EN-US>Box</span><span
style='font-family:宋体;"Times New Roman"'>模板。</span><span lang=EN-US>Box</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>模板虽然考虑了邻域点的作用,但并没有考虑各点位置的影响,对于所有的</span><span
lang=EN-US>9</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>个点都一视同仁,所以平滑的效果并不理想。实际上我们可以想象,离某点越近的点对该点的影响应该越大,为此,我们引入了加权系数,将原来的模板改造成</span><span
lang=EN-US><sub> <img width=107 height=75
src="chap03.files/image027.gif"  v:shapes="_x0000_i1077"> </sub> </span><span style='font-family:宋体;"Times New Roman";"Times New Roman"'>,可以看出,距离越近的点,加权系数越大。</span></p>
  <p style='line-height:18.0pt'><span
style='font-family:宋体;"Times New Roman"'>新的模板也是一个常用的平滑模板,称为高斯</span><span lang=EN-US>(Gauss)</span><span
style='font-family:宋体;"Times New Roman"'>模板。为什么叫这个名字,这是因为这个模板是通过采样</span><span lang=EN-US>2</span><span
style='font-family:宋体;"Times New Roman"'>维高斯函数得到的。</span></p>
  <p style='line-height:18.0pt'><span
style='font-family:宋体;"Times New Roman"'>设图象为</span><span lang=EN-US><sub> <img width=96 height=96
src="chap03.files/image028.gif"  v:shapes="_x0000_i1078"> </sub> </span><span style='font-family:宋体;"Times New Roman";"Times New Roman"'>,分别用两种平滑模板处理</span><span
lang=EN-US>(</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>周围一圈象素直接从原图拷贝</span><span lang=EN-US>)</span><span
style='font-family:宋体;"Times New Roman"'>。采用</span><span lang=EN-US>Box</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>模板的结果为</span><span
lang=EN-US><sub> <img width=135 height=96
src="chap03.files/image030.gif"  v:shapes="_x0000_i1079"> </sub> </span><span style='font-family:宋体;"Times New Roman";"Times New Roman"'>,采用高斯模板的结果为</span><span
lang=EN-US><sub> <img width=136 height=96
src="chap03.files/image032.gif"  v:shapes="_x0000_i1080"> </sub> </span><span style='font-family:宋体;"Times New Roman";"Times New Roman"'>。</span></p>
  <p style='line-height:18.0pt'><span
style='font-family:宋体;"Times New Roman"'>可以看到,原图中出现噪声的区域是第</span><span lang=EN-US>2</span><span
style='font-family:宋体;"Times New Roman"'>行第</span><span lang=EN-US>2</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>列和第</span><span
lang=EN-US>3</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>行第</span><span lang=EN-US>2</span><span
style='font-family:宋体;"Times New Roman"'>列,灰度从</span><span lang=EN-US>2</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>一下子跳到了</span><span
lang=EN-US>6</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>,用</span><span lang=EN-US>Box</span><span
style='font-family:宋体;"Times New Roman"'>模板处理后,灰度从</span><span lang=EN-US>3.11</span><span
style='font-family:宋体;"Times New Roman"'>跳到</span><span lang=EN-US>4.33</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>;用高斯模板处理后,灰度从</span><span
lang=EN-US>3.</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>跳到</span><span lang=EN-US>4.56,</span><span
style='font-family:宋体;"Times New Roman"'>都缓和了跳变的幅度,从这一点上看,两者都达到了平滑的目的。但是,原图中的第</span><span
lang=EN-US>3</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>,第</span><span lang=EN-US>4</span><span
style='font-family:宋体;"Times New Roman"'>行总的来说,灰度值是比较高的,经模板</span><span lang=EN-US>1</span><span
style='font-family:宋体;"Times New Roman"'>处理后,第</span><span lang=EN-US>3</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>行第</span><span
lang=EN-US>2</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>列元素的灰度变成了</span><span lang=EN-US>4.33</span><span
style='font-family:宋体;"Times New Roman"'>,与第</span><span lang=EN-US>3</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>,第</span><span
lang=EN-US>4</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>行的总体灰度相比偏小,另外,原图中第</span><span
lang=EN-US>3</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>行第</span><span lang=EN-US>2</span><span
style='font-family:宋体;"Times New Roman"'>列元素的灰度为</span><span lang=EN-US>6</span><span
style='font-family:宋体;"Times New Roman"'>,第</span><span lang=EN-US>3</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>行第</span><span
lang=EN-US>3</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>列元素的灰度为</span><span lang=EN-US>4</span><span
style='font-family:宋体;"Times New Roman"'>,变换后,后者</span><span lang=EN-US>4.56</span><span
style='font-family:宋体;"Times New Roman"'>反而比前者</span><span lang=EN-US>4.33</span><span
style='font-family:宋体;"Times New Roman"'>大了。而采用高斯模板没有出现这些问题,究其原因,就是因为它考虑了位置的影响。</span></p>
  <p style='line-height:18.0pt'><span
style='font-family:宋体;"Times New Roman"'>举个实际的例子:下图中,从左到右分别是原图,用高斯模板处理的图,用</span><span lang=EN-US>Box</span><span
style='font-family:宋体;"Times New Roman"'>模板处理的图,可以看出,采用高斯模板,在实现平滑效果的同时,要比</span><span lang=EN-US>Box</span><span
style='font-family:宋体;"Times New Roman"'>模板清晰一些。</span></p>
  <p style='line-height:18.0pt'><span
style='font-family:宋体;"Times New Roman"'>在学习锐化后,我们将给出一个通用的</span><span lang=EN-US>3</span><span
style='font-family:宋体;"Times New Roman"'>×</span><span lang=EN-US>3</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>模板操作的程序。</span></p>
  <p class=a style='line-height:18.0pt'><span lang=EN-US> <img width=537 height=193
src="chap03.files/image033.gif"  v:shapes="_x0000_i1039"> </span></p>
  <p align=center style='text-align:center;line-height:18.0pt'><b><span
style='font-family:宋体;"Times New Roman"'>图</span>3.3&nbsp;&nbsp;&nbsp;&nbsp; </b><b><span    
style='font-family:宋体;"Times New Roman"'>高斯模板和</span><span lang=EN-US>Box</span></b><b><span
style='font-family:宋体;"Times New Roman"'>模板的对比图</span><span lang=EN-US></span></b></p>
  <h2> <span
lang=EN-US>3.2</span> <span lang=EN-US> </span><a name="_Toc486331875"></a><a    
name="_Toc486332875"></a><a name="_Toc486338984"></a><a name="_Toc454810849"></a><a
name="_Toc454856623"><span><span>中值滤波</span></span></a></h2>
  <p style='line-height:18.0pt'><span
style='font-family:宋体;"Times New Roman"'>中值滤波也是一种典型的低通滤波器,它的目的是保护图象边缘的同时去除噪声。所谓中值滤波,是指把以某点</span><span
lang=EN-US>(x,y)</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>为中心的小窗口内的所有象素的灰度按从大到小的顺序排列,将中间值作为</span><span
lang=EN-US>(x,y)</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>处的灰度值</span><span lang=EN-US>(</span><span
style='font-family:宋体;"Times New Roman"'>若窗口中有偶数个象素,则取两个中间值的平均</span><span lang=EN-US>)</span><span
style='font-family:宋体;"Times New Roman"'>。中值滤波是如何去除噪声的呢?举个例子就很容易明白了。</span></p>
  <table border=0 cellspacing=0 cellpadding=0>
    <tr> 
      <td width=276 valign=top class="Normal"> 
        <p align=center style='text-align:center;line-height:18.0pt'><span
  style='font-family:宋体;"Times New Roman"'>原图</span></p>
      </td>
      <td width=276 valign=top class="Normal"> 
        <p align=center style='text-align:center;line-height:18.0pt'><span
  style='font-family:宋体;"Times New Roman"'>处理后的图</span></p>
      </td>
    </tr>
    <tr> 
      <td width=276 valign=top class="Normal"> 
        <p align=center style='text-align:center;line-height:18.0pt'><span
  lang=EN-US><sub> <img width=149 height=141
  src="chap03.files/image035.gif"  v:shapes="_x0000_i1040"> </sub> </span></p>
      </td>
      <td width=276 valign=top class="Normal"> 
        <p align=center style='text-align:center;line-height:18.0pt'><span
  lang=EN-US><sub> <img width=104 height=141
  src="chap03.files/image037.gif"  v:shapes="_x0000_i1041"> </sub> </span></p>
      </td>
    </tr>
  </table>
  <p style='line-height:18.0pt'><span
style='font-family:宋体;"Times New Roman"'>图中数字代表该处的灰度。可以看出原图中间的</span><span lang=EN-US>6</span><span
style='font-family:宋体;"Times New Roman"'>和周围的灰度相差很大,是一个噪声点。经过</span><span lang=EN-US>3</span><span
style='font-family:宋体;"Times New Roman"'>×</span><span lang=EN-US>1</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>窗口</span><span
lang=EN-US>(</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>即水平</span><span lang=EN-US>3</span><span
style='font-family:宋体;"Times New Roman"'>个象素取中间值</span><span lang=EN-US>)</span><span
style='font-family:宋体;"Times New Roman"'>的中值滤波,得到右边那幅图,可以看出,噪声点被去除了。</span></p>
  <p style='line-height:18.0pt'><span
style='font-family:宋体;"Times New Roman"'>下面将中值滤波和上面介绍的两种平滑模板作个比较,看看中值滤波有什么特点。我们以一维模板为例,只考虑水平方向,大小为</span><span
lang=EN-US>3</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>×</span><span lang=EN-US>1(</span><span
style='font-family:宋体;"Times New Roman"'>宽×高</span><span lang=EN-US>)</span><span style='font-family:
宋体;&quot;Times New Roman&quot;'>。</span><span
lang=EN-US>Box</span><span style='font-family:宋体;
&quot;Times New Roman&quot;'>模板为</span><span lang=EN-US><sub> <img width=85 height=41
src="chap03.files/image039.gif"  v:shapes="_x0000_i1033"> </sub> </span><span style='font-family:宋体;"Times New Roman";"Times New Roman"'>,高斯模板为</span><span
lang=EN-US><sub> <img width=88 height=41
src="chap03.files/image041.gif"  v:shapes="_x0000_i1034"> </sub> </span><span style='font-family:宋体;"Times New Roman";"Times New Roman"'>。</span></p>
  <p style='line-height:18.0pt'><span
style='font-family:宋体;"Times New Roman"'>先考察第一幅图:</span></p>
  <table border=0 cellspacing=0 cellpadding=0>
    <tr> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -