|
Convolution Integral for any dimensional data. More...
Functions | |
AFAPI array | convolve (const array &signal, const array &filter, const convMode mode=AF_CONV_DEFAULT, const convDomain domain=AF_CONV_AUTO) |
C++ Interface for convolution any(one through three) dimensional signals. More... | |
AFAPI array | convolve (const array &col_filter, const array &row_filter, const array &signal, const convMode mode=AF_CONV_DEFAULT) |
C++ Interface for separable convolution on two dimensional signals. More... | |
AFAPI af_err | af_convolve2_sep (af_array *out, const af_array col_filter, const af_array row_filter, const af_array signal, const af_conv_mode mode) |
C Interface for separable convolution on two dimensional signals. More... | |
Convolution Integral for any dimensional data.
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.
Depending on the dimensions of the input signal and the filter signal, any one of the following batch mode convolutions take place.
For example, if the signal is two dimensional with m & n as sizes along the 0th & 1st dimensions respectively, then the possible batch operations are as follows.
Input Signal Dimensions | Filter Dimensions | Output Dimensions | Batch Mode | Explanation |
---|---|---|---|---|
[m n 1 1] | [m n 1 1] | [m n 1 1] | No Batch | Output will be a single convolve array |
[m n 1 1] | [m n p 1] | [m n p 1] | Filter is Batched | p filters applied to same input |
[m n p 1] | [m n 1 1] | [m n p 1] | Signal is Batched | 1 filter applied to p inputs |
[m n p 1] | [m n p 1] | [m n p 1] | Identical Batches | p filters applied to p inputs in one-to-one correspondence |
[m n p 1] | [m n 1 q] | [m n p q] | Non-overlapping batches | q filters applied to p inputs in to produce p x q results |
[m n 1 p] | [m n q 1] | [m n q p] | Non-overlapping batches | q filters applied to p inputs in to produce q x p results |
AFAPI af_err af_convolve2_sep | ( | af_array * | out, |
const af_array | col_filter, | ||
const af_array | row_filter, | ||
const af_array | signal, | ||
const af_conv_mode | mode | ||
) |
C Interface for separable convolution on two dimensional signals.
[out] | out | is convolved array |
[in] | col_filter | is filter that has to be applied along the coloumns |
[in] | row_filter | is filter that has to be applied along the rows |
[in] | signal | is the input array |
[in] | mode | indicates if the convolution should be expanded or not(where output size equals input) |
AFAPI array af::convolve | ( | const array & | signal, |
const array & | filter, | ||
const convMode | mode = AF_CONV_DEFAULT , |
||
const convDomain | domain = AF_CONV_AUTO |
||
) |
C++ Interface for convolution any(one through three) dimensional signals.
Example for convolution on one dimensional signal in one to one batch mode
Example for convolution on two dimensional signal in one to one batch mode
Example for convolution on three dimensional signal in one to one batch mode
[in] | signal | is the input signal |
[in] | filter | is the signal that shall be flipped for the convolution operation |
[in] | mode | indicates if the convolution should be expanded or not(where output size equals input) |
[in] | domain | specifies if the convolution should be performed in frequency os spatial domain |
domain
, AF_CONV_AUTO, heuristically switches between frequency and spatial domain. AFAPI array af::convolve | ( | const array & | col_filter, |
const array & | row_filter, | ||
const array & | signal, | ||
const convMode | mode = AF_CONV_DEFAULT |
||
) |
C++ Interface for separable convolution on two dimensional signals.
[in] | signal | is the input signal |
[in] | col_filter | is the signal that shall be along coloumns |
[in] | row_filter | is the signal that shall be along rows |
[in] | mode | indicates if the convolution should be expanded or not(where output size equals input) |
domain
, AF_CONV_AUTO, heuristically switches between frequency and spatial domain.