Gaussian Filter is a low-pass discrete Gaussian filter that smooths out the image by doing a Gaussian-weighted averaging of neighbor pixels of a given input pixel. It produces images with less artifacts than Box Filter, but could potentially be more costly to compute.
It supports two modes of operation:
Kernel support size is automatically calculated based on the filter standard deviation (sigma).
Use both user-provided kernel support size and filter standard deviation.
Input
Gaussian kernel
Output
7x7 support,
\[ \sigma=1.7 \]
Implementation
Gaussian filter is implemented as a convolution operation on the input image where the kernel has the following weights:
When the input kernel support size is 0 for a given dimension (or both), it is calculated from the given standard deviation by assuming that the weights outside \(\pm3\sigma\) window are zero.
In this case, the following formula is used:
\[ w = \max\{3,2 \times \lceil 3\sigma\rceil-1\} \]
Note
We clamp the minimum kernel size to 3 because a kernel with size 1 doesn't have enough samples to properly characterize a Gaussian function.
C API functions
For list of limitations, constraints and backends that implements the algorithm, consult reference documentation of the following functions:
Use the CPU backend to filter the input image with a 7x7 Gaussian kernel with \(\sigma=1.7\), using ZERO boundary condition. Input and output are VPI images.
Submit the algorithm to the stream along with other parameters. It'll be executed by the CPU backend. It defines a Gaussian filter with 7x7 support and \(\sigma=1.7\) in both horizontal and vertical directions, along with a zero border extension.