[SciPy-user] convolve2d.. or Numeric to numarray conversion

Kasper Souren Kasper.Souren at ircam.fr
Fri Feb 14 11:48:25 EST 2003


> I just worked through some of this for one of our developers so
> numarray's Convolve.convolve2d now has an "fft" mode.  The short answer
> is,  use the convolution theorem and Numeric's FFT module:
>
>     Fdata = FFT.real_fft2d(data)
>     Fkernel = FFT.real_fft2d(kernel)
>     multiply(Fdata, Fkernel, Fdata)
>     convolved = inverse_real_fft2d( Fdata)
>
> The edges can be a little tricky,  but other than that, it's mostly
> already implemented (in Numeric) in the form of 2d Fourier transforms.
>  If the kernel you want to use is bigger than about 15x15,  the FFT is
> also an increasingly faster way of convolving than the brute force
> approach in numarray-0.4.

The multiply part gives me some troubles: ValueError: frames are not alligned.

It seems to me that multiply(a, b) just means a * b. And thus a and b need to 
have the same dimensions. And I don't know how to deal with this problem.
I guess filling up Fkernel with 0's doesn't make sense

bye,
Kasper





More information about the SciPy-User mailing list