[SciPy-User] Using scipy.signal.fftconvolve() and scipy.signal.convolve()

David Baddeley david_baddeley at yahoo.com.au
Tue Jan 18 16:19:24 EST 2011


What you're getting form fftconvolve looks about right - with ordinary convolve 
I suspect your problem might be that you're using 8 bit ints and it's 
overflowing & thus giving you the random noise pattern. Ffts cast their inputs 
to double first. I'd suggest casting your image to float - ie: 
a = a.astype('f')
before doing the standard convolutions.

cheers,
David


----- Original Message ----
From: Ábel Dániel <abli at freemail.hu>
To: scipy-user <scipy-user at scipy.org>
Sent: Wed, 19 January, 2011 8:58:28 AM
Subject: [SciPy-User] Using scipy.signal.fftconvolve() and 
scipy.signal.convolve()

[apologies if this might get duplicated, it appears my first
submission didn't show up on the mailling list]

Hi!

I would like to ask some help with the use of scipy.signal.convolve
and scipy.signal.fftconvolve. (On a greyscale 2d image.)

Based on the documentation of fftconvolve (which is simply 'See
convolve.'), I am assuming that they should give (mostly) the same
result. (I.e. the result won't be exactly identical since they are
using different methods, but they shouldn't be too different.)

However, I am getting drastically different results: using convolve
results in basically random noise, while fftconvolve gives a very
sharp peak.

I uploaded a short program with the input and the results I am getting
to http://hal.elte.hu/~abeld/scipy_signal_issue/

Am I doing something wrong? Should there be such a difference in the
output of these functions? What is causing the difference?

(I am using Ubuntu Lucid, version of python-scipy package is
0.7.0-2ubuntu0.1)

Thanks in advance,
Daniel Abel
abli at freemail.hu

_______________________________________________
SciPy-User mailing list
SciPy-User at scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user



      



More information about the SciPy-User mailing list