[SciPy-user] shift FFT2D...

Ryan May rmay at ou.edu
Wed May 9 11:45:37 EDT 2007


fred wrote:
> Hi all,
> 
> I use an FFT 2D on a matrix to compute a convolution like this:
> 
> a = fft2(input_data)
> b = fft2(output_data)
> c = real(ifft2(a*b))
> 
> The problem is that c should look like this:
> 
> c1 | c2
> -----------
> c3 | c4
> 
> but it looks like this:
> 
> c4 | c3
> -----------
> c2 | c1
> 
> How  can I get efficiently the right result ? (something like shift ?)
> 
Have you tried numpy.fft.fftshift?

I'm not sure if it works on matrices, but it shifts the 0 frequency 
component to the middle, which is what I think you're looking for.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma




More information about the SciPy-User mailing list