You can blur an image in OpenCV Python by any of the given methods. I highly recommend you get the “Computer Vision: Models, Learning, and Inference Book” to learn Computer Vision.
Method 1: Averaging
import cv2 img = cv2.imread('baby.jpg') Simple_blur = cv2.blur(img,(10,10)) cv2.imshow("Original Image",img) cv2.imshow('Simple blurring',Simple_blur) cv2.waitKey(0) cv2.destroyAllWindows()
Method 2: Gaussian Blurring
import cv2 img = cv2.imread('baby.jpg') gaussian_Blur = cv2.GaussianBlur(img, (5,5),0) cv2.imshow("Original Image",img) cv2.imshow('Gaussian Blurring', gaussian_Blur) cv2.waitKey(0) cv2.destroyAllWindows()
Method 3: Median Blurring
import cv2 img = cv2.imread('baby.jpg') median_Blur = cv2.medianBlur(img,5) cv2.imshow("Original Image",img) cv2.imshow('Median Blurring', median_Blur) cv2.waitKey(0) cv2.destroyAllWindows()
Method 4: Bilateral Filtering
import cv2 img = cv2.imread('baby.jpg') bilateral_Filter = cv2.bilateralFilter(img,9,75,75) cv2.imshow("Original Image",img) cv2.imshow('Bilateral Filtering', bilateral_Filter) cv2.waitKey(0) cv2.destroyAllWindows()