Book Image

Learning Raspberry Pi

By : Samarth Shah
Book Image

Learning Raspberry Pi

By: Samarth Shah

Overview of this book

Table of Contents (14 chapters)
Learning Raspberry Pi
About the Author
About the Reviewers

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


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:

  1. Create a new folder named chapter6 under your home folder...