being n
2
in an n-by-n kernel size to being 2n for each pixel. The OpenCV implementation of Gaussian
smoothing also provides even higher performance for several common kernels. 3-by-3, 5-by-5, and 7-by-7
with the “standard” sigma (i.e., sigmaX = 0.0) give better performance than other kernels. Gaussian
blur supports single- or three-channel images in either 8-bit or 32-bit floating-point formats, and it can be
done in place. Results of Gaussian blurring are shown in Figure 5-10.
Bilateral Filter
Figure 5-12: Results of bilateral smoothing
void cv::bilateralFilter(
cv::InputArray src, // Input Image
cv::OutputArray dst, // Result image
int d, // Pixel neighborhood size (max distance)
double sigmaColor, // Width parameter for color weighting function
double sigmaSpace, // Width parameter for spatial weighting function
int borderType = cv::BORDER_DEFAULT // Border extrapolation to use
);
The fifth and final form of smoothing supported by OpenCV is called bilateral filtering [Tomasi98], an
example of which is shown in Figure 5-12. Bilateral filtering is one operation from a somewhat larger class
of image analysis operators known as edge-preserving smoothing. Bilateral filtering is most easily
understood when contrasted to Gaussian smoothing. A typical motivation for Gaussian smoothing is that
pixels in a real image should vary ...