Performs a convolution. More...

Modules

 convolve
 C++ interface for Convolution.
 
 af_conv
 C interface for Convolution.
 

Detailed Description

Performs a convolution.

A convolution is a common operation between a source array, a, and a filter (or kernel) array b. The answer to the convolution is the same as computing the coefficients in polynomial multiplication, if a and b are the coefficients.

Another way to think about it is that the filter kernel is centered on each pixel in a, and the output for that pixel or data point is the sum of the products.

Consider the following example with the calculation for the first few points shown as a comment:

array a = seq(1, 8);
//a = 1.0000
// 2.0000
// 3.0000
// 4.0000
// 5.0000
// 6.0000
// 7.0000
// 8.0000
array b = seq(0, 2);
b = pow2(b);
//b = 1.0000
// 2.0000
// 4.0000
array out = convolve(a,b);
//out = 4.0000 (0*4)+(1*2)+(2*1)
// 11.0000 (1*4)+(2*2)+(3*1)
// 18.0000 (2*4)+(3*2)+(4*1)
// 25.0000 ...
// 32.0000
// 39.0000
// 46.0000
// 44.0000

Note that pixels that are outside an image or data points that are outside the domain of a signal are treated as zero.