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

📄 chp8.htm

📁 数字图象处理入门,非常好的书!!!!推荐!
💻 HTM
📖 第 1 页 / 共 5 页
字号:
    <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:198pt;
   height:104.25pt'>
   <v:imagedata src="./chp8.files/image001.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap08.files/image001.gif"/>
  </v:shape><![endif]--><![if !vml]><img width=264 height=139
  src="./chp8.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>8.1&nbsp;&nbsp;&nbsp; </b><b><span lang=ZH-CN style='font-family:
  宋体'>单词</span>THE</b></p>
  </td>
  <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:shape id="_x0000_i1026"
   type="#_x0000_t75" alt="" style='width:114.75pt;height:102.75pt'>
   <v:imagedata src="./chp8.files/image002.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap08.files/image003.gif"/>
  </v:shape><![endif]--><![if !vml]><img width=153 height=137
  src="./chp8.files/image002.gif" v:shapes="_x0000_i1026"><![endif]></p>
  <p class=a style='line-height:18.0pt'><b><span lang=ZH-CN style='font-family:
  宋体'>图</span>8.2&nbsp;&nbsp;&nbsp; </b><b><span lang=ZH-CN style='font-family:
  宋体'>看不见的三角</span></b></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"'>8.1</span><span
lang=ZH-CN style='font-size:10.5pt'>是单词</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>THE</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"'>8.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><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"'>OCR)</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"'>(</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"'>MPEG4</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"'>(</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>

<h2 style='text-align:justify;text-justify:inter-ideograph'><span
style='font-family:"Times New Roman"'>8.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"'>(</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"'>(</span><span
lang=ZH-CN style='font-size:10.5pt'>这里选</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>175</span><span lang=ZH-CN style='font-size:
10.5pt'>到</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>220)</span><span
lang=ZH-CN style='font-size:10.5pt'>,将该图二值化,如图</span><span style='font-size:
10.5pt;font-family:"Times New Roman"'>8.3</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 align=center>

<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:shape id="_x0000_i1027"
   type="#_x0000_t75" alt="" style='width:162pt;height:162pt'>
   <v:imagedata src="./chp8.files/image003.jpg" o:href="http://www-scf.usc.edu/~flv/ipbook/chap08.files/image005.jpg"/>
  </v:shape><![endif]--><![if !vml]><img width=216 height=216
  src="./chp8.files/image003.jpg" v:shapes="_x0000_i1027"><![endif]></p>
  <p class=a style='line-height:18.0pt'><b><span lang=ZH-CN style='font-family:
  宋体'>图</span>8.3&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 class=a style='line-height:18.0pt'><!--[if gte vml 1]><v:shape id="_x0000_i1028"
   type="#_x0000_t75" alt="" style='width:161.25pt;height:162.75pt'>
   <v:imagedata src="./chp8.files/image004.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap08.files/image007.gif"/>
  </v:shape><![endif]--><![if !vml]><img width=215 height=217
  src="./chp8.files/image004.gif" v:shapes="_x0000_i1028"><![endif]></p>
  <p class=a style='line-height:18.0pt'><b><span lang=ZH-CN style='font-family:
  宋体'>图</span>8.4&nbsp;&nbsp;&nbsp; </b><b><span lang=ZH-CN style='font-family:
  宋体'>削波处理,将图</span>8.3</b><b><span lang=ZH-CN style='font-family:宋体'>二值化</span></b></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"'>8.5</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 class=a style='margin:0cm;margin-bottom:.0001pt;line-height:18.0pt'><!--[if gte vml 1]><v:shape
 id="_x0000_i1029" type="#_x0000_t75" alt="" style='width:157.5pt;height:126pt'>
 <v:imagedata src="./chp8.files/image005.jpg" o:href="http://www-scf.usc.edu/~flv/ipbook/chap08.files/image009.jpg"/>
</v:shape><![endif]--><![if !vml]><img width=210 height=168
src="./chp8.files/image005.jpg" v:shapes="_x0000_i1029"><![endif]></p>

<p align=center style='margin:0cm;margin-bottom:.0001pt;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"'>8.5&nbsp;&nbsp;&nbsp;&nbsp;
</span></b><b><span lang=ZH-CN style='font-size:10.5pt'>图</span></b><b><span
style='font-size:10.5pt;font-family:"Times New Roman"'>8.4</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>

<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"'><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"'>BOOL</span><span
lang=ZH-CN style='font-size:10.5pt'>变量,为真时表示在水平方向上做投影,否则在垂直方向上做投影。要注意的是,我们针对的虽然是二值图,但为了处理的方便,用的是</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>256</span><span
lang=ZH-CN style='font-size:10.5pt'>级灰度图,不过只用到了</span><span style='font-size:
10.5pt;font-family:"Times New Roman"'>0</span><span lang=ZH-CN
style='font-size:10.5pt'>和</span><span style='font-size:10.5pt;font-family:
"Times New Roman"'>255</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 style='font-size:10.5pt;font-family:
"Times New Roman"'>BOOL Projection(HWND hWnd,BOOL Hori)<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 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 style='font-size:10.5pt;font-family:
"Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DWORD &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
OffBits,BufSize;<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 style='font-size:10.5pt;font-family:
"Times New Roman"'>LPBITMAPINFOHEADER&nbsp;&nbsp;&nbsp; lpImgData;<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 style='font-size:10.5pt;font-family:
"Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LPSTR&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
lpPtr;<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 style='font-size:10.5pt;font-family:
"Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
HLOCAL&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hTempImgData;<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 style='font-size:10.5pt;font-family:
"Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
LPBITMAPINFOHEADER&nbsp;&nbsp;&nbsp; lpTempImgData;<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 style='font-size:10.5pt;font-family:
"Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LPSTR
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; lpTempPtr;<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 style='font-size:10.5pt;font-family:
"Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HDC
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
hDc;<o:p></o:p></span></p>

⌨️ 快捷键说明

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