In this post, you will learn How to blur an image in python.
Blur an Image –
To blur an Image we can transform each pixel to be the average value of it’s neighbors. In openCV this is done by using a kernel. The size of the kernel determines how much we want to blur an image. Increasing the size will increase the blur of an image.
# load libraries import cv2 import numpy as np import matplotlib.pyplot as plt # load an image image = cv2.imread('maldives.jpg', cv2.IMREAD_GRAYSCALE) # blur image image_blur = cv2.blur(image, (25, 25)) # show image plt.imshow(image_blur, cmap="gray") plt.axis("off") plt.show()