[SciPy-User] Rotated, Anisotropic Gaussian Filtering (Kernel Density Estimation)
Patrick Marsh
patrickmarshwx at gmail.com
Fri Oct 19 13:18:15 EDT 2012
On Fri, Oct 19, 2012 at 9:34 AM, Daπid <davidmenhur at gmail.com> wrote:
> If you are going to apply different filters to the same image, it may
> be faster to switch to the Fourier transform. In this case, the
> result is the IFT of the FT of your data multiplied by the FT of your
> kernel.
>
> Doing all the FT may be expensive, but it can be useful if you are
> reusing the data, and Scipy is linked to very optimized FFT libraries.
Thanks to all who have taken time to respond to my initial email. I'm
learning a lot here.
With that said, I'm intrigued with the idea of using FFTs. I knew it was
possible but had never actually looked into how to do it. As a simple
experiment, I generated a simple kernel using my Cython code and took the
FFT of this 2D array. I then attempted to apply it using the
IFFT(FFT(kernel) * FFT(hist)) method described about. You can see the
result here: http://nbviewer.ipython.org/3919393/. Obviously, I'm doing
something wrong here, but I'm not sure what. Why is the result separated
into the four corners and not the center of the grid? Any help in figuring
this out…or pointers to references...would be appreciated.
Also, I'm assuming that the kernel and the image need to be the same
dimensions or the multiplication won't work?
Thanks again to all for helping wrap my head around this.
Patrick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20121019/81d5d0a1/attachment.html>
More information about the SciPy-User
mailing list