[Matrix-SIG] general 2D convolution, again.

David Ascher David Ascher <da@skivs.ski.org>
Fri, 27 Mar 1998 09:04:55 -0800 (PST)


On Fri, 27 Mar 1998, Dirk Engelmann wrote:

> > Problem: doing 2D convolutions with non-square and different shape arrays
> > is (from what I've read) not doable using FFT multiplication.  Has anyone
> > coded such a convolution in either straight NumPy or using a C extension
> > module?  Linear, circular, with sweet-spot setting, etc?  
> 
> I need it  for image processing - and for large images (matrices) 
> FFT is quite usefull - but not for non-square shape.
> If done it in my C++ library with swig interface to Python. But it's 
> not that flexible (Linear, circular, ...).
> 
> I would like to have it in NumPy very much!

Right, I'm doing image-processing-like sorts of things.

I got impatient and wrote one, but I have to finish the details It's not
smart at all, but someone who likes to optimize C code can feel free
to take my code and make it run like the wind.  At this point having
*something* is more important to me than having the best.

I suspect that a smart FFT based implementation would be much faster, but
I don't have the confidence to know how to do it right.  Once I'm
convinced that I have a working implementation, it can be used as a
reference implementation for checking an FFT-based implementation.

More news later...

--david