[Numpy-discussion] Interpolation via Fourier transform
Fri Mar 6 11:33:54 CST 2009
It was one of the first things I tried, without success
מאת: email@example.com בשם Anne Archibald
נשלח: ה 05-מרץ-09 22:06
אל: Discussion of Numerical Python
נושא: Re: [Numpy-discussion] Interpolation via Fourier transform
2009/3/5 M Trumpis <firstname.lastname@example.org>:
> Hi Nadav.. if you want a lower resolution 2d function with the same
> field of view (or whatever term is appropriate to your case), then in
> principle you can truncate your higher frequencies and do this:
> sig = ifft2_func(sig[N/2 - M/2:N/2 + M/2, N/2 - M/2:N/2+M/2])
> I like to use an fft that transforms from an array indexing
> negative-to-positive freqs to an array that indexes
> negative-to-positive spatial points, so in both spaces, the origin is
> at (N/2,N/2). Then the expression works as-is.
> The problem is if you've got different indexing in one or both spaces
> (typically positive frequencies followed by negative) you can play
> around with a change of variables in your DFT in one or both spaces.
> If the DFT is defined as a computing frequencies from 0,N, then
> putting in n' = n-N/2 leads to a term like exp(1j*pi*q) that
> multiplies f[q]. Here's a toy example:
> a = np.cos(2*np.pi*5*np.arange(64)/64.)
> The second one is centered about index N/2
> Similarly, if you need to change the limits of the summation of the
> DFT from 0,N to -N/2,N/2, then you can multiply exp(1j*pi*n) to the
> outside of the summation.
> Like I said, easy enough in principle!
There's also the hit-it-with-a-hammer approach: Just downsample in x
then in y, using the one-dimensional transforms.
Numpy-discussion mailing list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 3955 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090306/036d2ed9/attachment-0001.bin
More information about the Numpy-discussion