Convolution Integral for any(one through three) 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 | fftConvolve (const array &signal, const array &filter, const convMode mode=AF_CONV_DEFAULT) |
C++ Interface for FFT-based convolution any(one through three) dimensional signals. More... | |
Convolution Integral for any(one through three) 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 size of the signal and the filter, any one of the following batch mode convolutions take place.
This version of convolution function delegates the call to respective 1D, 2D or 3D convolution functions internally.
Convolution dimensionality is \( \min (sd, fd) \) where sd & fd are dimensionality of signal and filter respectively. This formulation only decides the dimensionality of convolution.
Given below are some examples on how convolution dimensionality is computed.
Signal Size | Filter Size | Input Rank | Filter Rank | Convolve Dimensionality |
---|---|---|---|---|
\( [m \ n \ 1 \ 1] \) | \( [m \ 1 \ 1 \ 1] \) | 2 | 1 | \( min(2, 1) => \) 1D |
\( [m \ 1 \ 1 \ 1] \) | \( [m \ n \ 1 \ 1] \) | 1 | 2 | \( min(1, 2) => \) 1D |
\( [m \ n \ 1 \ 1] \) | \( [m \ n \ 1 \ 1] \) | 2 | 2 | \( min(2, 2) => \) 2D |
\( [m \ n \ 1 \ 1] \) | \( [m \ n \ p \ 1] \) | 2 | 3 | \( min(2, 3) => \) 2D |
\( [m \ n \ 1 \ p] \) | \( [m \ n \ 1 \ q] \) | 4 | 4 | 3D |
\( [m \ n \ p \ 1] \) | \( [m \ n \ q \ 1] \) | 3 | 3 | \( min(3, 3) => \) 3D |
If the operation you intend to perform doesn't align with what this function does, please check the rank specific convolve functions (hyperlinked below) documentation to find out more.
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.
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 fftConvolve | ( | const array & | signal, |
const array & | filter, | ||
const convMode | mode = AF_CONV_DEFAULT |
||
) |
C++ Interface for FFT-based convolution any(one through three) dimensional signals.
[in] | signal | is the input signal |
[in] | filter | is the signal that shall be used for the convolution operation |
[in] | mode | indicates if the convolution should be expanded or not(where output size equals input) |