Important image processing operations
In the previous chapter, you learned about the basic image processing operations. This section will cover an important image processing operation, which is widely used in complex image processing algorithms:
The image smoothing filter
Morphological operations
The image smoothing filter
Image smoothing is used to remove the noise. Basically, it removes high frequency contents from the image. Noise and sharp edges are typically high frequency contents. As it removes edges along with the noise from an image, it will blur the image. OpenCV has mainly four types of smoothing filters:
Averaging filter
Gaussian filtering
Median filtering
Bilateral filtering
Averaging
The averaging technique takes the average of all the pixels under the kernel area and replaces the central element with this average. This can be achieved using cv2.blur()
or cv2.boxFilter()
functions. The following are the steps to achieve averaging:
Create a new folder named
chapter6
under yourhome
folder...