[Numpy-discussion] second 2d fft gives the same result as fft+ifft

bela bela.mihalik at gmail.com
Tue Jun 9 11:19:28 EDT 2009


I tried to calculate the second fourier transformation of an image with the
following code below:

---------------------------------------------------------------
import pylab
import numpy

### Create a simple image

fx = numpy.zeros( 128**2 ).reshape(128,128).astype( numpy.float )

for i in xrange(8):
	for j in xrange(8):
		fx[i*8+16][j*8+16] = 1.0

### Fourier Transformations

Ffx = numpy.copy( numpy.fft.fft2( fx ).real )   # 1st fourier
FFfx = numpy.copy( numpy.fft.fft2( Ffx ).real )  # 2nd fourier
IFfx = numpy.copy( numpy.fft.ifft2( Ffx ).real )   # inverse fourier

### Display result

pylab.figure( 1, figsize=(8,8), dpi=125 )

pylab.subplot(221)
pylab.imshow( fx, cmap=pylab.cm.gray )
pylab.colorbar()
pylab.title( "fx" )

pylab.subplot(222)
pylab.imshow( Ffx, cmap=pylab.cm.gray )
pylab.colorbar()
pylab.title( "Ffx" )

pylab.subplot(223)
pylab.imshow( FFfx, cmap=pylab.cm.gray )
pylab.colorbar()
pylab.title( "FFfx" )

pylab.subplot(224)
pylab.imshow( IFfx, cmap=pylab.cm.gray )
pylab.colorbar()
pylab.title( "IFfx" )

pylab.show()
---------------------------------------------------------------

On my computer FFfx is the same as IFfx..... but why?

I uploaded a screenshot about my result here:
http://server6.theimagehosting.com/image.php?img=second_fourier.png

Bela


-- 
View this message in context: http://www.nabble.com/second-2d-fft-gives-the-same-result-as-fft%2Bifft-tp23945026p23945026.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.




More information about the NumPy-Discussion mailing list