![]() |
Blitz Support : |
From: Todd Veldhuizen (tveldhui_at_[hidden])
Date: 2003-06-19 10:48:11
Hi Navneet,
There is a method convolve(Array<T,1> x, Array<T,1> y) that computes the
1-D convolution of two arrays. This would be a fairly poor way of
implementing a 2D separable convolution though :(. Although it
would be fairly easy to provide another version of convolve that
allows you to provide a destination array for the result.. then
you could avoid temporaries by allocating a 2D array for the result,
and doing a loop over the rows/columns with a convolve for each.
Do you want cyclic or acyclic boundaries? If acyclic, do you want the
result truncated to the size of the original 2D array? How big is the 1D
gaussian compared to the 2D array size? One possibility is to use an FFT
package.. if your 1D signal is of size n, and your 2D array is of size m,
then if n >> log(m) you're probably better of with FFTs is my guess
(depending on whether you're looking at ease of implementation vs.
efficiency).
Cheers,
Todd
-- Todd Veldhuizen / tveldhui_at_[hidden] / Indiana University Computer Science On Wed, 18 Jun 2003, Dalal, Navneet wrote: > Hi everybody, > > I am new to Blitz++ and am stuck with one problem. > > I want to convolve a 2D signal with a 1D signal, let us say first along > x-axis and then along y-axis. > The reason is my 1D signal is separable (it is Gaussian). So this operation > will be much faster. > > Now I have two questions: > > 1. How can I do these operations in blitz using stencils, expression > templates, etc? > > 2. Ideally one would like to use 1D convolution signal to convolve first > along x-axis and then convolve new signal along y-axis. Can I avoid > temporaries? > > thanks > navneet > _______________________________________________ > Blitz-support mailing list > Blitz-support_at_[hidden] > http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support >