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

📄 chp3.htm

📁 数字图象处理入门,非常好的书!!!!推荐!
💻 HTM
📖 第 1 页 / 共 5 页
字号:
style='font-family:"Times New Roman"'>3.1 </span><span lang=ZH-CN
style='mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:"Times New Roman"'>平滑</span><span
style='font-family:"Times New Roman"'><o:p></o:p></span></h2>

<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>先举个例子说明一下什么是平滑</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>(smoothing)</span><span
lang=ZH-CN style='font-size:10.5pt'>,如下面两幅图所示:可以看到,图</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>3.2</span><span
lang=ZH-CN style='font-size:10.5pt'>比图</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>3.1</span><span lang=ZH-CN style='font-size:
10.5pt'>柔和一些</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>(</span><span
lang=ZH-CN style='font-size:10.5pt'>也模糊一些</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>)</span><span lang=ZH-CN style='font-size:10.5pt'>。是不是觉得很神奇?其实实现起来很简单。我们将原图中的每一点的灰度和它周围八个点的灰度相加,然后除以</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>9</span><span
lang=ZH-CN style='font-size:10.5pt'>,作为新图中对应点的灰度,就能实现上面的效果。</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>

<div>

<table border=0 cellspacing=0 cellpadding=0 style='mso-cellspacing:0cm;
 mso-padding-alt:0cm 0cm 0cm 0cm'>
 <tr>
  <td width=276 valign=top style='width:207.0pt;padding:0cm 0cm 0cm 0cm'>
  <p class=a style='line-height:18.0pt'><!--[if gte vml 1]><v:shapetype id="_x0000_t75"
   coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
   filled="f" stroked="f">
   <v:stroke joinstyle="miter"/>
   <v:formulas>
    <v:f eqn="if lineDrawn pixelLineWidth 0"/>
    <v:f eqn="sum @0 1 0"/>
    <v:f eqn="sum 0 0 @1"/>
    <v:f eqn="prod @2 1 2"/>
    <v:f eqn="prod @3 21600 pixelWidth"/>
    <v:f eqn="prod @3 21600 pixelHeight"/>
    <v:f eqn="sum @0 0 1"/>
    <v:f eqn="prod @6 1 2"/>
    <v:f eqn="prod @7 21600 pixelWidth"/>
    <v:f eqn="sum @8 21600 0"/>
    <v:f eqn="prod @7 21600 pixelHeight"/>
    <v:f eqn="sum @10 21600 0"/>
   </v:formulas>
   <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
   <o:lock v:ext="edit" aspectratio="t"/>
  </v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" alt="" style='width:127.5pt;
   height:141.75pt'>
   <v:imagedata src="./chp3.files/image001.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap03.files/image001.gif"/>
  </v:shape><![endif]--><![if !vml]><img width=170 height=189
  src="./chp3.files/image001.gif" v:shapes="_x0000_i1025"><![endif]></p>
  <p class=a style='line-height:18.0pt'><b><span lang=ZH-CN style='font-family:
  宋体'>图</span>3.1&nbsp;&nbsp;&nbsp; </b><b><span lang=ZH-CN style='font-family:
  宋体'>原图</span></b></p>
  </td>
  <td width=276 valign=top style='width:207.0pt;padding:0cm 0cm 0cm 0cm'>
  <p align=center style='text-align:center;line-height:18.0pt'><span
  style='font-size:10.5pt;font-family:"Times New Roman"'><!--[if gte vml 1]><v:shape
   id="_x0000_i1026" type="#_x0000_t75" alt="" style='width:126pt;height:141pt'>
   <v:imagedata src="./chp3.files/image002.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap03.files/image003.gif"/>
  </v:shape><![endif]--><![if !vml]><img width=168 height=188
  src="./chp3.files/image002.gif" v:shapes="_x0000_i1026"><![endif]><o:p></o:p></span></p>
  <p align=center style='text-align:center;line-height:18.0pt'><b><span
  lang=ZH-CN style='font-size:10.5pt'>图</span></b><b><span style='font-size:
  10.5pt;font-family:"Times New Roman"'>3.2&nbsp;&nbsp;&nbsp;&nbsp; </span></b><b><span
  lang=ZH-CN style='font-size:10.5pt'>经过平滑处理后的图</span></b><span
  style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>
  </td>
 </tr>
</table>

</div>

<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>这么做并非瞎蒙,而是有其道理的。大概想一想,也很容易明白。举个例子,就象和面一样,先在中间加点水,然后不断把周围的面和进来,搅拌几次,面就均匀了。</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>

<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>用信号处理的理论来解释,这种做法实现的是一种简单的低通滤波器</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>(low pass filter)</span><span
lang=ZH-CN style='font-size:10.5pt'>。哇,好深奥呀!不要紧,这些理论的内容并不多,而且知道一些理论也是很有好处的。在灰度连续变化的图象中,如果出现了与相邻象素的灰度相差很大的点,比如说一片暗区中突然出现了一个亮点,人眼能很容易觉察到。就象看老电影时,由于胶片太旧,屏幕上经常会出现一些亮斑。这种情况被认为是一种噪声。灰度突变在频域中代表了一种高频分量,低通滤波器的作用就是滤掉高频分量,从而达到减少图象噪声的目的。</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>

<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>为了方便地叙述上面所说的“将原图中的每一点的灰度和它周围八个点的灰度相加,然后除以</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>9</span><span
lang=ZH-CN style='font-size:10.5pt'>,作为新图中对应点的灰度”这一操作,我们采用如下的表示方法:</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>

<p align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;
line-height:18.0pt'><b><sub><span style='font-size:10.5pt;font-family:"Times New Roman"'><!--[if gte vml 1]><v:shape
 id="_x0000_i1027" type="#_x0000_t75" alt="" style='width:69pt;height:56.25pt'>
 <v:imagedata src="./chp3.files/image003.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap03.files/image005.gif"/>
</v:shape><![endif]--><![if !vml]><img width=92 height=75
src="./chp3.files/image003.gif" v:shapes="_x0000_i1027"><![endif]></span></sub></b><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>

<p align=right style='margin:0cm;margin-bottom:.0001pt;text-align:right;
line-height:18.0pt'><span style='font-size:10.5pt;font-family:"Times New Roman"'>(3.1)<o:p></o:p></span></p>

<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>这种表示方法有点象矩阵,我们称其为模板</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>(template)</span><span
lang=ZH-CN style='font-size:10.5pt'>。中间的黑点表示中心元素,即,用哪个元素做为处理后的元素。例如</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>[2. 1]</span><span
lang=ZH-CN style='font-size:10.5pt'>表示将自身的</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>2</span><span lang=ZH-CN style='font-size:10.5pt'>倍加上右边的元素作为新值,而</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>[2 1.]</span><span
lang=ZH-CN style='font-size:10.5pt'>表示将自身加上左边元素的</span><span style='font-size:
10.5pt;font-family:"Times New Roman"'>2</span><span lang=ZH-CN
style='font-size:10.5pt'>倍作为新值。</span><span style='font-size:10.5pt;font-family:
"Times New Roman"'><o:p></o:p></span></p>

<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>通常,模板不允许移出边界,所以结果图象会比原图小,例如模板是</span><sub><span
lang=ZH-CN style='font-size:10.5pt;font-family:"Times New Roman"'> </span></sub><sub><span
style='font-size:10.5pt;font-family:"Times New Roman"'><!--[if gte vml 1]><v:shape
 id="_x0000_i1028" type="#_x0000_t75" alt="" style='width:38.25pt;height:36pt'>
 <v:imagedata src="./chp3.files/image004.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap03.files/image007.gif"/>
</v:shape><![endif]--><![if !vml]><img width=51 height=48
src="./chp3.files/image004.gif" v:shapes="_x0000_i1028"><![endif]></span></sub><span
lang=ZH-CN style='font-size:10.5pt'>,原图是</span><sub><span lang=ZH-CN
style='font-size:10.5pt;font-family:"Times New Roman"'> </span></sub><sub><span
style='font-size:10.5pt;font-family:"Times New Roman"'><!--[if gte vml 1]><v:shape
 id="_x0000_i1029" type="#_x0000_t75" alt="" style='width:89.25pt;height:1in'>
 <v:imagedata src="./chp3.files/image005.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap03.files/image009.gif"/>
</v:shape><![endif]--><![if !vml]><img width=119 height=96
src="./chp3.files/image005.gif" v:shapes="_x0000_i1029"><![endif]></span></sub><span
lang=ZH-CN style='font-size:10.5pt'>,经过模板操作后的图象为</span><sub><span lang=ZH-CN
style='font-size:10.5pt;font-family:"Times New Roman"'> </span></sub><sub><span
style='font-size:10.5pt;font-family:"Times New Roman"'><!--[if gte vml 1]><v:shape
 id="_x0000_i1030" type="#_x0000_t75" alt="" style='width:90pt;height:1in'>
 <v:imagedata src="./chp3.files/image006.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap03.files/image011.gif"/>
</v:shape><![endif]--><![if !vml]><img width=120 height=96
src="./chp3.files/image006.gif" v:shapes="_x0000_i1030"><![endif]></span></sub><span
lang=ZH-CN style='font-size:10.5pt'>;其中数字代表灰度,</span><span style='font-size:
10.5pt;font-family:"Times New Roman"'>x</span><span lang=ZH-CN
style='font-size:10.5pt'>表示边界上无法进行模板操作的点,通常的做法是复制原图的灰度,不进行任何处理。</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>

<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>模板操作实现了一种邻域运算</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>(Neighborhood Operation)</span><span
lang=ZH-CN style='font-size:10.5pt'>,即某个象素点的结果灰度不仅和该象素灰度有关,而且和其邻域点的值有关。在以后介绍的细化算法中,我们还将接触到邻域运算。模板运算的数学涵义是一种卷积</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>(</span><span
lang=ZH-CN style='font-size:10.5pt'>或互相关</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>)</span><span lang=ZH-CN style='font-size:10.5pt'>运算,你不需要知道卷积的确切含义,只要有这么一个概念就可以了。</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>

<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>模板运算在图象处理中经常要用到,可以看出,它是一项非常耗时的运算。以</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>

<p align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;
line-height:18.0pt'><sub><span style='font-size:10.5pt;font-family:"Times New Roman"'><!--[if gte vml 1]><v:shape
 id="_x0000_i1031" type="#_x0000_t75" alt="" style='width:80.25pt;height:56.25pt'>
 <v:imagedata src="./chp3.files/image007.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap03.files/image013.gif"/>
</v:shape><![endif]--><![if !vml]><img width=107 height=75
src="./chp3.files/image007.gif" v:shapes="_x0000_i1031"><![endif]></span></sub><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>

<p align=right style='margin:0cm;margin-bottom:.0001pt;text-align:right;
line-height:18.0pt'><span style='font-size:10.5pt;font-family:"Times New Roman"'>(3.2)<o:p></o:p></span></p>

<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:
inter-ideograph;line-height:18.0pt'><span lang=ZH-CN style='font-size:10.5pt'>为例,每个象素完成一次模板操作要用</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>9</span><span
lang=ZH-CN style='font-size:10.5pt'>个乘法、</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>8</span><span lang=ZH-CN style='font-size:10.5pt'>个加法、</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>1</span><span
lang=ZH-CN style='font-size:10.5pt'>个除法。对于一幅</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>n</span><span lang=ZH-CN style='font-size:10.5pt'>×</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>n(</span><span
lang=ZH-CN style='font-size:10.5pt'>宽度×高度</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>)</span><span lang=ZH-CN style='font-size:10.5pt'>的图象,就是</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>9n<sup>2</sup></span><span
lang=ZH-CN style='font-size:10.5pt'>个乘法,</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>8n<sup>2</sup></span><span lang=ZH-CN
style='font-size:10.5pt'>个加法和</span><span style='font-size:10.5pt;font-family:
"Times New Roman"'>n<sup>2</sup></span><span lang=ZH-CN style='font-size:10.5pt'>个除法,算法复杂度为</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>O(n<sup>2</sup>)</span><span
lang=ZH-CN style='font-size:10.5pt'>,这对于大图象来说,是非常可怕的。所以,一般常用的模板并不大,如</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>3</span><span
lang=ZH-CN style='font-size:10.5pt'>×</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>3</span><span lang=ZH-CN style='font-size:10.5pt'>,</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>4</span><span
lang=ZH-CN style='font-size:10.5pt'>×</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>4</span><span lang=ZH-CN style='font-size:10.5pt'>。有很多专用的图象处理系统,用硬件来完成模板运算,大大提高了速度。另外,可以设法将二维模板运算转换成一维模板运算,对速度的提高也是非常可观的。例如,</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>(3.2)</span><span
lang=ZH-CN style='font-size:10.5pt'>式可以分解成一个水平模板和一个垂直模板,即,</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'><o:p></o:p></span></p>

<p align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;
line-height:18.0pt'><sub><span style='font-size:10.5pt;font-family:"Times New Roman"'><!--[if gte vml 1]><v:shape
 id="_x0000_i1032" type="#_x0000_t75" alt="" style='width:80.25pt;height:56.25pt'>
 <v:imagedata src="./chp3.files/image007.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap03.files/image014.gif"/>

⌨️ 快捷键说明

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