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

📄 361-365.html

📁 dshfghfhhgsfgfghfhfghgfhfghfgh fg hfg hh ghghf hgf hghg gh fg hg hfg hfh f hg hgfh gkjh kjkh g yj f
💻 HTML
字号:
<HTML>
<HEAD>
<META name=vsisbn content="1558515682"><META name=vstitle content="Java Digital Signal Processing"><META name=vsauthor content="Douglas A. Lyon"><META name=vsimprint content="M&T Books"><META name=vspublisher content="IDG Books Worldwide, Inc."><META name=vspubdate content="11/01/97"><META name=vscategory content="Web and Software Development: Programming, Scripting, and Markup Languages: Java"><TITLE>Java Digital Signal Processing:Image Processing in Java</TITLE>
<!-- HEADER --><STYLE type="text/css">  <!-- A:hover  { 	color : Red; } --></STYLE><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<!--ISBN=1558515682//-->
<!--TITLE=Java Digital Signal Processing//-->
<!--AUTHOR=Douglas A. Lyon//-->
<!--PUBLISHER=IDG Books Worldwide, Inc.//-->
<!--IMPRINT=M & T Books//-->
<!--CHAPTER=9//-->
<!--PAGES=361-365//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->

<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="355-361.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="365-371.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P>All 2-D FFTs (described in this book) are centered using Equation 9.12. A proof of the time-shift theorem for the 1D continuous case follows.
</P>
<P ALIGN="CENTER"><IMG SRC="images/09-20d.jpg"></P>
<P>Q.E.D.
</P>
<P>We can take a similar approach in the 2-D discrete time domain to prove Equation 9.7:</P>
<P ALIGN="CENTER"><IMG SRC="images/09-21d.jpg"></P>
<P>Invoking the definition of the continuous Fourier transform Equation 9.7 yields the following:
</P>
<P ALIGN="CENTER"><IMG SRC="images/09-22d.jpg"></P>
<P>(9.13)
</P>
<P>Let</P>
<P ALIGN="CENTER"><IMG SRC="images/09-23d.jpg"></P>
<P>(9.14)
</P>
<P>so that</P>
<P ALIGN="CENTER"><IMG SRC="images/09-24d.jpg"></P>
<P>By substitution we obtain
</P>
<P ALIGN="CENTER"><IMG SRC="images/09-25d.jpg"></P>
<P>from which
</P>
<P ALIGN="CENTER"><IMG SRC="images/09-26d.jpg"></P>
<P>follows.
</P>
<P>Q.E.D.</P>
<P>Further usage and optimization details are discussed in the following section.</P>
<H3><A NAME="Heading4"></A><FONT COLOR="#000077">The FFTPlane Class</FONT></H3>
<P>The <I>FFTPlane</I> class resides in the <I>lyon.ipl</I> package. It provides an object-oriented 2-D color FFT and IFFT service. An instance of the <I>FFTPlane</I> class can be created from an instance of the <I>PixelPlane</I> class. <I>FFTPlane</I> treats all images as color and is not smart about conserving memory when working with achromatic images. <I>FFTPlane</I> makes a copy of the pixels in the <I>PixelPlane</I> instance. The copy is stored internally using complex red, green, and blue arrays of float type.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B>It is important to set an <I>FFTPlane</I> instance to null to reclaim the memory used when it is finished.<HR></FONT>
</BLOCKQUOTE>
<P><I>FFTPlane</I> has the ability to multiply each of its internally complex numbers in the frequency domain by real numbers stored in a <I>PixelPlane</I> instance. This arrangement enables the implementation of 2-D filters.</P>
<H4 ALIGN="LEFT"><A NAME="Heading5"></A><FONT COLOR="#000077">Class Summary</FONT></H4>
<!-- CODE //-->
<PRE>
package lyon.ipl;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import gui.*;
import VS.*;
public class FFTPlane &#123;
public FFTPlane(ProcessPlane ppIn)
public void mult( ProcessPlane ppIn)
public void fft()
public void ifft()
&#125;
</PRE>
<!-- END CODE //-->
<H4 ALIGN="LEFT"><A NAME="Heading6"></A><FONT COLOR="#000077">Class Usage</FONT></H4>
<P>Suppose the following variables are predefined:
</P>
<!-- CODE SNIP //-->
<PRE>
FFTPlane fftp;
ProcessPlane pp; // pp is a 2**n by 2**n image
ProcessPlane filter;
</PRE>
<!-- END CODE SNIP //-->
<P>To make an instance of the <I>FFTPlane</I>, use the following:</P>
<!-- CODE SNIP //-->
<PRE>
fftp = new FFTPlane(pp);
</PRE>
<!-- END CODE SNIP //-->
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B>The <I>ProcessPlane</I> instance is altered by the methods in the <I>FFTPlane</I> instances.<HR></FONT>
</BLOCKQUOTE>
<P>To perform an in-place FFT on the instance of the <I>fftp</I>, use this scale:</P>
<!-- CODE SNIP //-->
<PRE>
fftp.fft();
</PRE>
<!-- END CODE SNIP //-->
<P>The results of the <I>fft</I> method are left in internal data structures. The <I>ProcessPlane</I> instance is altered to show the log of the PSD.</P>
<P>To perform a multiplication, pixel by pixel, from the real pixels in <I>filter</I>, replacing the complex pixels in the <I>fftp</I> instance:</P>
<!-- CODE SNIP //-->
<PRE>
fftp.mult(filter);
</PRE>
<!-- END CODE SNIP //-->
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B>The <I>filter</I> instance should have the same dimensions as the <I>fftp</I>. Also, the pixels should vary from 0 to 255. They will be divided by 255 (so as not to increase the magnitude of the <I>fftp</I> result) before they are multiplied. The multiplication works with color filters (any <I>ProcessPlane</I> that contains colors).<HR></FONT>
</BLOCKQUOTE>
<P>To invoke an IFFT on an instance of the <I>FFTPlane</I> class and place the result in the original <I>ProcessPlane</I> instance, <I>pp</I> use:</P>
<!-- CODE SNIP //-->
<PRE>
fftp.ifft();
</PRE>
<!-- END CODE SNIP //-->
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>WARNING:&nbsp;&nbsp;</B>This destroys the original <I>ProcessPlane</I> instance, <I>pp</I>.<HR></FONT>
</BLOCKQUOTE>
<P>In the following section, we show how to retrofit the <I>ProcessPlane</I> class so that any instance of <I>ProcessPlane</I> can support the <I>fft()</I>, <I>mult(pp)</I>, and <I>ifft()</I> invocations.</P>
<H4 ALIGN="LEFT"><A NAME="Heading7"></A><FONT COLOR="#000077">The ProcessPlane Implementation</FONT></H4>
<P>We have retrofitted the <I>ProcessPlane</I> class with an <I>fft</I> method. We hold that this is the preferred way to perform a 2-D FFT, leaving the <I>FFTPlane</I> defined for those who would like the ability to extend its abilities. The <I>ProcessPlane</I> is retrofitted as follows:</P>
<!-- CODE //-->
<PRE>
     private FFTPlane fftp;
public void fft() &#123;
     System.out.println(&#147;Running the FFT...&#148;);
     fftp = new FFTPlane(this);
     fftp.fft();
&#125;
public void multFFT(ProcessPlane pp_) &#123;
     if (fftp == null) &#123;
          fft();
     &#125;
     else &#123;
          fftp.mult(pp_);
     &#125;
&#125;
public void ifft() &#123;
     System.out.println(&#147;Running the iFFT...&#148;);
     if (fftp == null) &#123;
          System.out.println(&#147;You must take the FFT first!&#148;);
     &#125;
     else
          fftp.ifft();
&#125;
</PRE>
<!-- END CODE //-->
<P>The <I>ImageFrame</I> class has been updated to permit multiplication by images that are stored in the <I>childFrame</I>. The update for the <I>ImageFrame</I> class follows:</P>
<!-- CODE //-->
<PRE>
public void fft() &#123;
     pp.fft();
     updateDisplay(pp);
&#125;
public void multFFT() &#123;
     pp.multFFT(childFrame.pp);
     updateDisplay(pp);
&#125;

public void ifft() &#123;
     pp.ifft();
     updateDisplay(pp);
&#125;
</PRE>
<!-- END CODE //-->
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="355-361.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="365-371.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>

<hr width="90%" size="1" noshade><div align="center"><font face="Verdana,sans-serif" size="1">Copyright &copy; <a href="/reference/idgbooks00001.html">IDG Books Worldwide, Inc.</a></font></div>
<!-- all of the reference materials (books) have the footer and subfoot reveresed --><!-- reference_subfoot = footer --><!-- reference_footer = subfoot --></BODY></HTML><!-- END FOOTER -->

⌨️ 快捷键说明

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