📄 chp2.htm
字号:
<h2 style='text-align:justify;text-justify:inter-ideograph'><span
style='font-family:"Times New Roman"'>2.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"'>(translation)</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"'>2.1</span><span
lang=ZH-CN style='font-size:10.5pt'>所示,初始坐标为</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>(x<sub>0</sub>,y<sub>0</sub>)</span><span
lang=ZH-CN style='font-size:10.5pt'>的点经过平移</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>(t<sub>x</sub>,t<sub>y</sub>)(</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"'>(x<sub>1</sub>,y<sub>1</sub>)</span><span lang=ZH-CN
style='font-size:10.5pt'>。这两点之间的关系是</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>x<sub>1</sub>=x<sub>0</sub>+t<sub>x </sub></span><span
lang=ZH-CN style='font-size:10.5pt'>,</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>y<sub>1</sub>=y<sub>0</sub>+t<sub>y</sub></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'><!--[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:146.25pt;
height:152.25pt'>
<v:imagedata src="./chp2.files/image001.jpg" o:href="http://www-scf.usc.edu/~flv/ipbook/chap02.files/image002.jpg"/>
</v:shape><![endif]--><![if !vml]><img width=195 height=203
src="./chp2.files/image001.jpg" v:shapes="_x0000_i1025"><![endif]></p>
<p align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center'><b><span
lang=ZH-CN style='font-size:10.5pt'>图</span></b><b><span style='font-size:10.5pt;
font-family:"Times New Roman"'>2.1 </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 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_i1026" type="#_x0000_t75" alt="" style='width:183pt;height:57.75pt'>
<v:imagedata src="./chp2.files/image002.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap02.files/image004.gif"/>
</v:shape><![endif]--><![if !vml]><img width=244 height=77
src="./chp2.files/image002.gif" v:shapes="_x0000_i1026"><![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"'>
(2.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"'><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_i1027" type="#_x0000_t75" alt="" style='width:201pt;height:57.75pt'>
<v:imagedata src="./chp2.files/image003.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap02.files/image006.gif"/>
</v:shape><![endif]--><![if !vml]><img width=268 height=77
src="./chp2.files/image003.gif" v:shapes="_x0000_i1027"><![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"'>(2.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"'>RGB</span><span
lang=ZH-CN style='font-size:10.5pt'>值是多少?很显然,该点是原图的某点经过平移后得到的,这两点的颜色肯定是一样的,所以只要知道了原图那点的</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>RGB</span><span
lang=ZH-CN style='font-size:10.5pt'>值即可。那么到底新图中的左上角点对应原图中的哪一点呢?将左上角点的坐标</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>(0,0)</span><span
lang=ZH-CN style='font-size:10.5pt'>入公式</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>(2.2)</span><span lang=ZH-CN style='font-size:
10.5pt'>,得到</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>x<sub>0=</sub>-t<sub>x
</sub></span><span lang=ZH-CN style='font-size:10.5pt'>,</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>y<sub>0</sub>=-t<sub>y</sub></span><span
lang=ZH-CN style='font-size:10.5pt'>;所以新图中的</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>(0,0)</span><span lang=ZH-CN style='font-size:
10.5pt'>点的颜色和原图中</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>(-t<sub>x</sub>
, -t<sub>y</sub>)</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"'>(x<sub>1</sub>,y<sub>1</sub>)</span><span
lang=ZH-CN style='font-size:10.5pt'>,按照公式</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>(2.2)</span><span lang=ZH-CN style='font-size:
10.5pt'>得到的</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>(x<sub>0</sub>,y<sub>0</sub>)</span><span
lang=ZH-CN style='font-size:10.5pt'>不在原图中该怎么办?通常的做法是,把该点的</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>RGB</span><span
lang=ZH-CN style='font-size:10.5pt'>值统一设成</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>(0,0,0)</span><span lang=ZH-CN style='font-size:
10.5pt'>或者</span><span style='font-size:10.5pt;font-family:"Times New Roman"'>(255,255,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 lang=ZH-CN style='font-size:10.5pt'>另一个问题是:平移后的图象是否要放大?一种做法是不放大,移出的部分被截断。例如,图</span><span
style='font-size:10.5pt;font-family:"Times New Roman"'>2.2</span><span
lang=ZH-CN style='font-size:10.5pt'>为原图,图</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>2.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>
<p class=a style='margin:0cm;margin-bottom:.0001pt;line-height:18.0pt'><!--[if gte vml 1]><v:shape
id="_x0000_i1028" type="#_x0000_t75" alt="" style='width:229.5pt;height:144.75pt'>
<v:imagedata src="./chp2.files/image004.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap02.files/image008.gif"/>
</v:shape><![endif]--><![if !vml]><img width=306 height=193
src="./chp2.files/image004.gif" v:shapes="_x0000_i1028"><![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"'>2.2
</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 align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;
line-height:18.0pt'><b><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:231pt;height:146.25pt'>
<v:imagedata src="./chp2.files/image005.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap02.files/image010.gif"/>
</v:shape><![endif]--><![if !vml]><img width=308 height=195
src="./chp2.files/image005.gif" v:shapes="_x0000_i1029"><![endif]></span></b><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><span lang=ZH-CN style='font-size:10.5pt'>图</span></b><b><span
style='font-size:10.5pt;font-family:"Times New Roman"'>2.3
</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"'>2.4</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_i1030" type="#_x0000_t75" alt="" style='width:271.5pt;height:183pt'>
<v:imagedata src="./chp2.files/image006.gif" o:href="http://www-scf.usc.edu/~flv/ipbook/chap02.files/image012.gif"/>
</v:shape><![endif]--><![if !vml]><img width=362 height=244
src="./chp2.files/image006.gif" v:shapes="_x0000_i1030"><![endif]></p>
<p class=a style='margin:0cm;margin-bottom:.0001pt;line-height:18.0pt'><b><span
lang=ZH-CN style='font-family:宋体'>图</span>2.4 </b><b><span
lang=ZH-CN style='font-family:宋体'>移动后图象被放大</span></b></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"'>w<sub>1</sub>,h<sub>1</sub></span><span
lang=ZH-CN style='font-size:10.5pt'>则新图的宽和高变为</span><span style='font-size:
10.5pt;font-family:"Times New Roman"'>w<sub>1</sub>+|t<sub>x</sub>|</span><span
lang=ZH-CN style='font-size:10.5pt'>和</span><span style='font-size:10.5pt;
font-family:"Times New Roman"'>h<sub>1</sub>+|t<sub>y</sub>|</span><span
lang=ZH-CN style='font-size:10.5pt'>,加绝对值符号是因为</span><span style='font-size:
10.5pt;font-family:"Times New Roman"'>t<sub>x</sub>, t<sub>y</sub></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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -