Image filtering
In this starting section, you will learn about linear and non-linear image filtering methods available in OpenCV. It's important to note that all of the functions discussed in this section take a Mat
image as an input and produce a Mat
image of the same size and the same number of channels. In fact, the filters are applied to each channel independently. In general, filtering methods take a pixel and its pixels from the input image and calculate the value of the corresponding pixel in the resulting image based on a function response from those pixels.
This usually requires an assumption to be made about the pixels that do not exist, while calculating the filtered pixel result. OpenCV provides a number of methods to overcome this issue, and they can be specified in almost all of the OpenCV functions that need to deal with this phenomenon using the cv::BorderTypes
enum. We will see how it is used in our first example in this chapter a bit later, but, before that, let's make...