Hello, I started using numarray for doing 2D convolutions on images. I noticed that import numarray.examples.convolve.high_level as convolve convolve.Convolve2d(kernel, in, out) only works on square images. For images that are not square I get lots of noise in the background. Also I was wondering is using the high_level API is most efficient? Currently my image is a Numeric array (grabbed from the OpenGL frame buffer) which I convert to a numarray to do the convolution and back to a Numeric array. In the future I hope to completely replace Numeric by numarray. Thanks for any input -Michel -- ----------------------------------------------------------------------- o / Michel F. Sanner Ph.D. The Scripps Research Institute o Associate Professor Department of Molecular Biology \ 10550 North Torrey Pines Road o Tel. (858) 784-2341 La Jolla, CA 92037 / Fax. (858) 784-2860 o sanner@scripps.edu http://www.scripps.edu/~sanner -----------------------------------------------------------------------
On Tue, 2004-06-22 at 11:51, Michel Sanner wrote:
Hello,
I started using numarray for doing 2D convolutions on images. I noticed that
import numarray.examples.convolve.high_level as convolve convolve.Convolve2d(kernel, in, out)
only works on square images. For images that are not square I get lots of noise in the background.
I looked at the code and couldn't find any row/column typos. In theory, Convolve2d works for non-square arrays. What do kernel.info() and data.info() say?
Also I was wondering is using the high_level API is most efficient?
For CPU, my guess is yes. The point access macros and functions are definitely slower than the high level API in any scenario where you're not running out of memory. The 1D API improves space usage but is less efficient in time. The Numeric compatible API is layered over the high level API.
Currently my image is a Numeric array (grabbed from the OpenGL frame buffer) which I convert to a numarray to do the convolution and back to a Numeric array.
It's also possible something is happening during this conversion. It'd be good to round-trip the Numeric array and make sure the end product looks like the original.
In the future I hope to completely replace Numeric by numarray.
Great! Regards, Todd
On Tue, 2004-06-22 at 11:51, Michel Sanner wrote:
Hello,
I started using numarray for doing 2D convolutions on images. I noticed that
import numarray.examples.convolve.high_level as convolve convolve.Convolve2d(kernel, in, out)
Here's another (quick?) test which might help localize the problem. Do: convolve.Convolve2d(kernel, in, out, fft=1) The underlying Convolve2d implementations are very different depending on the use of FFT. Regards, Todd
participants (2)
-
Michel Sanner
-
Todd Miller