
OpenCV 3 Computer Vision Application Programming Cookbook
By :

The first recipe of this chapter introduced the concept of linear filters. Non-linear filters also exist and can be advantageously used in image processing. One such filter is the median filter that we present in this recipe.
Since median filters are particularly useful in order to combat salt-and-pepper noise (or salt-only, in our case), we will use the image we created in the first recipe of Chapter 2 , Manipulating Pixels, which is reproduced here:
The call to the median filtering function is done in a way that is similar to the other filters:
cv::medianBlur(image, result, 5); // last parameter is size of the filter
The resulting image is as follows:
Since the median filter is not a linear filter, it cannot be represented by a kernel matrix, it cannot be applied through a convolution operation (that is, using the double-summation equation introduced in the first recipe of this chapter). However...
Change the font size
Change margin width
Change background colour