0% found this document useful (0 votes)
26 views2 pages

Gaussian Blur in OpenCV for Smoothing

Uploaded by

dsr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

Gaussian Blur in OpenCV for Smoothing

Uploaded by

dsr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Lab-3: To perform Image Smoothing and Blurring usingPython OpenCV

Image smoothing and blurring are common techniques used in image processing to reduce
noise and detail in an image. OpenCV provides several methods for this in Python.

 Image noise refers to random variations in brightness or color information within an


image, often appearing as grainy or speckled patterns

✅ Common Methods in OpenCV for Smoothing/Blurring:

1. Averaging (Mean Filter)

2. Gaussian Blur

3. Median Blur

4. Bilateral Filter

📌 Required Library:

pip install opencv-python

✅ Example Code: Image Smoothing and Blurring in Python (Using OpenCV)

🔍 Explanation:

Method Description Use Case

Averages pixels in a kernel area (simple


[Link]() Basic denoising
smoothing)

Uses Gaussian kernel for weighted


[Link]() Better for natural blurring
smoothing

Takes the median value of surrounding Good for removing salt-and-


[Link]()
pixels pepper noise

Smooths image while keeping edges Best for face smoothing, edge-
[Link]()
sharp preserving
1. Gaussian Blur Example-

import cv2

import numpy as np

# Load the image

image = [Link]('your_image.jpg')

# Check if image loaded successfully

if image is None:

print("Error: Could not load image.")

else:

# Apply Gaussian blurring with a 5x5 kernel and sigmaX=0 (auto-calculated)

blurred_gaussian = [Link](image, (5, 5), 0)

# Display the original and blurred images

[Link]('Original Image', image)

[Link]('Gaussian Blurred Image', blurred_gaussian)

[Link](0)

[Link]()

You might also like