0% found this document useful (0 votes)
2 views24 pages

Noise and Image Filtering

Uploaded by

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

Noise and Image Filtering

Uploaded by

akomaajulia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Image Filtering

Definition of Image Filtering


• Image filtering is a technique used to modify or enhance
an image by applying a filter, which is typically
represented by a kernel or a mask. Filters can smooth
images, highlight features like edges, or reduce noise.
Noise
• Noise in image processing refers to random variations in
pixel values caused by errors in image acquisition,
transmission, or storage.
• Noise distorts image quality and makes image analysis
and processing tasks more challenging.
Sources of Noise
Noise is caused by any of the following:
1. Sensor Limitations: Imperfections in imaging
hardware, such as CCD or CMOS sensors.
2. Environmental Factors: Variations in lighting,
temperature, or electrical interference.
3. Transmission Errors: Signal degradation or data loss
during transmission.
4. Quantization Noise: Occurs when analog signals are
converted to digital form.
5. Compression Artifacts: Errors introduced by lossy
image compression methods.
Noise Models
• Mathemtically, noise can be represented as:

• Where
• Noisy image
• Original image
• Noise component
• For multiplicative noise (e.g., speckle noise):
• .N
Types of Noise
• Noise is grouped by the following:
1. Gaussian Noise
2. Salt-and-pepper Noise (Impulse noise)
3. Speckle Noise
4. Poisson Noise (Short Noise)
5. Periodic Noise
Gaussian Noise
• Gaussian noise, also known as normal noise, follows a
normal distribution. It is characterized by its mean (μ)
and standard deviation (σ), which determine its
intensity and spread. Mathematically, Gaussian noise is
represented as:
Causes of Gaussian Noise
• Thermal Noise: Generated by sensors due to
temperature.
• Electronic Noise: Occurs due to electronic components
in imaging devices.
• Acquisition Noise: Results from imperfections in the
image acquisition process.
Characteristics of Gaussian Noise
Characteristics of Gaussian Noise
1.Normal Distribution: Follows the bell-curve
probability distribution.
2.Additive Nature: Can be modeled as:

Inoisy = Ioriginal+N

3. Wide Applicability: Commonly used in image


processing for testing and simulating real-world scenarios
Effects of Gaussian Noise
• Distortion: Blurs edges and fine details.
• Performance Degradation: Reduces the efficiency of
segmentation, edge detection, and feature extraction.
Reducing Gaussian Noise
1.Spatial Domain Filters:
1.Gaussian Blur: Smoothens the image while preserving
edges.
2.Bilateral Filter: Combines spatial and intensity information
to preserve edges better.
2.Frequency Domain Filters:
1.Low-Pass Filters: Suppress high-frequency components
associated with noise.
3.Advanced Techniques:
1.Non-Local Means, Wavelet Transform, and Deep Learning
models
Practical Implementation
12. # Display original and noisy images
• (a) Adding Gaussian Noise
13. plt.figure(figsize=(10, 5))
1. import cv2
2. import numpy as np 14. plt.subplot(1, 2, 1)
3. from matplotlib import pyplot as plt
4. # Load the image 15. plt.imshow(image, cmap='gray’)
5. image = cv2.imread('example.jpg', 16. plt.title('Original Image’)
cv2.IMREAD_GRAYSCALE)
6. # Add Gaussian noise 17. plt.axis('off’)
7. mean = 0
8. std_dev = 20 # Standard deviation 18. plt.subplot(1, 2, 2)
9. gaussian_noise = np.random.normal(mean,
std_dev, image.shape).astype(np.float32) 19. plt.imshow(noisy_image, cmap='gray’)
10. noisy_image =
cv2.add(image.astype(np.float32), 20. plt.title('Gaussian Noisy Image’)
gaussian_noise)
21. plt.axis('off’)
11. noisy_image =
np.clip(noisy_image, 0, 255).astype(np.uint8)
22. plt.show()
Removal of Gaussian Noise with
filters
Using Gaussian Blur
1. # Apply Gaussian blur
2. blurred_image = cv2.GaussianBlur(noisy_image, (5, 5), 0)

3. # Display the results


4. plt.figure(figsize=(10, 5))
5. plt.subplot(1, 2, 1)
6. plt.imshow(noisy_image, cmap='gray')
7. plt.title('Noisy Image')
8. plt.axis('off')

9. plt.subplot(1, 2, 2)
10. plt.imshow(blurred_image, cmap='gray')
11. plt.title('Gaussian Blurred Image')
12. plt.axis('off')

13. plt.show()
1. # Apply bilateral filter
2. bilateral_filtered = cv2.bilateralFilter(noisy_image, 9, 75, 75)

3. # Display the results


4. plt.figure(figsize=(10, 5))
5. plt.subplot(1, 2, 1)
6. plt.imshow(noisy_image, cmap='gray')
7. plt.title('Noisy Image')
8. plt.axis('off')

9. plt.subplot(1, 2, 2)
10. plt.imshow(bilateral_filtered, cmap='gray')
11. plt.title('Bilateral Filtered Image')
12. plt.axis('off')

13. plt.show()
Salt-and-pepper noise
• Salt-and-Pepper Noise, also known as impulse noise, appears
as randomly occurring white (salt) and black (pepper) pixels in
an image.
• This type of noise corrupts pixel intensities and replace them
with maximum or minimum intensity values.

2. Causes of Salt-and-Pepper Noise


1.Transmission Errors: Corruption during image transmission.
2.Faulty Pixels in Sensors: Defective imaging sensors in digital
cameras.
3.Signal Processing Errors: Errors in data conversion or
compression.
1.Effects of Salt-and-Pepper Noise
1.Image Degradation: Loss of fine details and sharpness.
2.Diminished Segmentation Accuracy: Algorithms may fail to detect
edges and features.
3.Reduced Visual Quality: Appearance of white and black spots impacts
visual aesthetics.

Techniques to Reduce Salt-and-Pepper Noise


4.Median Filter: Replaces each pixel value with the median of its
neighbors.
5.Adaptive Filters: Adjust filtering strength based on the local noise level.
6.Non-Local Means Filtering: Considers the similarity between patches
in the image.
Speckle Noise
• Speckle noise is a multiplicative noise that typically
occurs in images captured by coherent imaging
systems, such as radar, ultrasound, and laser-based
imaging devices. Unlike additive noise (e.g., Gaussian
noise), speckle noise is proportional to the intensity of
the image.
Mathematical Model of Speckle
Noise
• Mathemtically, Speckle noise can be represented as:

• Where
• Intensity of the noisy image at pixel location (x, y)
• Intensity of the original image at (x, y)
• Multiplicative noise, which follows a uniform or
Gaussian distributiove around
Causes of Speckle Noise
1. Interference: Constructive and destructive interference of
coherent waves in imaging systems.
2. Scattering: Multiple scattering events in imaging mediums like
tissue in medical imaging.

Characteristics
3. Multiplicative: Noise intensity is proportional to the underlying
image intensity.
4. Grainy Texture: Appears as granular patterns over the image.
5. Spatial Correlation: Noise pattern is spatially correlated,
depending on imaging systems.
Effects
1. Degrades Image Quality: Reduces contrast and obscures details.
2. Hinders Analysis: Affects segmentation, edge detection, and feature
extraction.

Reducing Speckle Noise


• Spatial Domain Techniques:
• Median Filtering: Reduces speckle while preserving edges.
• Adaptive Filtering: Adjusts based on local noise statistics.
• Frequency Domain Techniques:
• Wiener Filtering: Accounts for noise power spectrum.
• Advanced Methods:
• Non-Local Means Filtering, Wavelet Transform, Deep Learning Models
Implementation
Noise Reduction Techniques
(a) Spatial Domain Filtering
1.Mean Filter:
1. Replaces each pixel with the average of its neighborhood.
2. Effective for Gaussian noise but blurs edges.
2.Median Filter:
1. Replaces each pixel with the median of its neighborhood.
2. Excellent for salt-and-pepper noise.
3.Gaussian Filter:
1. Weights neighboring pixels using a Gaussian distribution.
2. Provides smooth results while preserving edges.
(b) Frequency Domain Filtering
1.Low-Pass Filtering:
• Removes high-frequency noise while preserving low-frequency image
features.
2.Band-Stop Filtering:
• Removes specific frequency bands, e.g., periodic noise.
(c) Advanced Noise Reduction Techniques
1. Non-Local Means Denoising:
• Averages similar pixel neighborhoods, regardless of spatial distance.
2. Wavelet Transform Denoising:
• Removes noise in transformed domains like the wavelet domain.
3. Deep Learning Models:
• Convolutional neural networks (CNNs) trained for noise reduction.

You might also like