Image blur refers to the effect of making an image less sharp and more difficult to distinguish the details. Although blurring is typically a negative effect in photographs, it is useful method in image processing tasks. Image blur is used in image processing for a variety of reasons, such as image smoothing, edge detection, obscuring sensitive information, and preprocessing steps.
Image blur is achieved by convolving the image with a specific kernel or filter. A kernel is a small matrix that is applied to each pixel in the image. The value of each pixel in the output image is calculated by multiplying the corresponding values in the kernel with the values of the pixels in the neighborhood of the current pixel, and then summing the results.
In this tutorial, you'll briefly learn how to blur image with OpenCV API in Python.
The tutorial covers;
- Gaussian blur
- Median blur
- Bilateral filter method
- Averaging method
- Source code listing
We'll start by loading the required libraries.
import cv2 import matplotlib.pyplot as plt