OpenCV  3.4.7-pre
Open Source Computer Vision
Smoothing Images

Prev Tutorial: Random generator and text with OpenCV

Next Tutorial: Eroding and Dilating

Goal

In this tutorial you will learn how to apply diverse linear filters to smooth images using OpenCV functions such as:

Theory

Note
The explanation below belongs to the book Computer Vision: Algorithms and Applications by Richard Szeliski and to LearningOpenCV

Normalized Box Filter

Gaussian Filter

The median filter run through each element of the signal (in this case the image) and replace each pixel with the median of its neighboring pixels (located in a square neighborhood around the evaluated pixel).

Bilateral Filter

Code

Explanation

Let's check the OpenCV functions that involve only the smoothing procedure, since the rest is already known by now.

Normalized Block Filter:

Gaussian Filter:

Median Filter:

Bilateral Filter

Results