Write a program to blur and smoothing an image

Write a program to blur and smoothing an image.

Program:

import cv2

# Load the image
image = cv2.imread('atc.jpg')

# Apply different blurs
gaussian_blur = cv2.GaussianBlur(image, (5, 5), 0)
median_blur = cv2.medianBlur(image, 5)
bilateral_filter = cv2.bilateralFilter(image, 9, 75, 75)

# Display the original and processed images
cv2.imshow('Original Image', image)
cv2.imshow('Gaussian Blur', gaussian_blur)
cv2.imshow('Median Blur', median_blur)
cv2.imshow('Bilateral Filter', bilateral_filter)

# Wait for a key press to close the windows
cv2.waitKey(0)
cv2.destroyAllWindows()

Leave a Reply

Your email address will not be published. Required fields are marked *