0% found this document useful (0 votes)
2 views

10. Spatial filtering

The document discusses various image processing techniques, particularly focusing on filtering methods such as low pass filtering, Gaussian filtering, and order statistics filters. It highlights the importance of noise reduction in images, explaining different types of noise and their effects on image quality, as well as the mathematical principles behind various filtering techniques. Additionally, it covers the advantages and disadvantages of median filtering in removing impulsive noise while preserving edges.

Uploaded by

Hritik Anand
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

10. Spatial filtering

The document discusses various image processing techniques, particularly focusing on filtering methods such as low pass filtering, Gaussian filtering, and order statistics filters. It highlights the importance of noise reduction in images, explaining different types of noise and their effects on image quality, as well as the mathematical principles behind various filtering techniques. Additionally, it covers the advantages and disadvantages of median filtering in removing impulsive noise while preserving edges.

Uploaded by

Hritik Anand
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

We need them before re-sampling, segmentation and other pre-procesing

Equivalent to LOW PASS FILTERING

Solution : advanced filters : adaptive, edge preserving

pixel regions that are small with respect to the size of the filter kernel
Some generalized patters of mask/kernel
• If the coefficients of the mask sum to one, the average brightness of
the image will be retained.
• If the coefficients of the mask sum to zero, the average brightness
will be lost and will return a dark image.
• If the coefficients of the mask are alternatively positive and negative,
the mask is a filter that returns edge information only.
• If the coefficients of the mask are all positive, it is a filter that will
blur the image.
Smooth Sharpen Intensify Enhance

Correlation tells you how similar the signal is to the filter at any point. This is used for image alignment,
template matching and simple image matching.
Can you tell the difference between these three smoothing filters?
All real-world recorded images are DIRTY : degraded by noise,
 Image De-noising
external disturbance transmission, satellite, wireless network
image acquisition and/or transmission Can we ESTIMATE the ideal from the noisy observed image?

The variance σ^2 of the noise affects the image quality,

SNR is poor for high spatial frequencies? Why ?


The(magnitude)spectra of typical images are decreasing functions of spatial frequency, : less power at high
spatial frequencies. In contrast, noise power spectral ens are often flat(e.g.,white noise) or approximately flat.
It is natural to use a low pass filter to remove those poor SNR components and preserve the good SNR
components at low spatial frequencies.
Convoluted image G = h*g
h*[f+n)
E{h*f+ h*n}
H*f + h*E[n]
Noise is removed
Please note this important aspect of LOW PASS FILTERING of white noise : derivation not required

Note the uncorrelated property of white noise


Speckle Noise: pixel values multiplied by random noise

dots, speckles, stains


Dots can be modeled as impulses, or
salt-and-pepper or speckle)
Randomly pick a pixel and
randomly set to a value
Speckle noise? Shot/binary
Periodic noise
ISO factor: it indicates how quickly a
camera’s sensor absorbs light ,
higher ISO more noise
Assumptions: noise is independent of spatial coordinates (except for
periodic noise) and independent of the image.
Unanticipated image structures,
often also called noise, it is a real repeatable Signal
What about quantization noise? How is it different? not statistical
Periodic noise can be cleaned using frequency domain filtering, most of the others both spatial/frequency
Impulse (Salt-and-Pepper) Noise
The PDF of (bipolar) impulse noise is given by
 Pa for z  a

p( z )   Pb for z  b
0
 otherwise

if b  a, gray-level b will appear as a light dot,


while level a will appear like a dark dot.

If either Pa or Pb is zero, the impulse noise is called


unipolar
12
We normalize such that the sum of h(m, n)=1

The name “box kernel” comes from a constant kernel


resembling a box when viewed in 3-D

Averaging reduces the variability of the gray values of the input


image; its smooths the function:
increases SNR by the square-root of the number of pixels
averaged if the noise is random and the averaging weights are
identical
Local averaging decreases the “variability” (variance) of pixel gray values
Local averaging “pushes” gray values towards the mean
Three standard ways to handle the boundary pixels top/bottom few rows
and few of the right/left columns :
Ignore these locations,
Zero padding or border padding
Periodicity: top row wraps around to the bottom row
Leftmost column wraps to the rightmost
What if we want nearest neighboring pixels to have the most influence on the output
GAUSSIAN FILTER : weights are taken from a Gaussian function

𝝈 = 𝟏 𝑮𝒂𝒖𝒔𝒔𝒊𝒂𝒏 𝒇𝒊𝒍𝒕𝒆𝒓

Size of kernel or mask–Gaussian function has infinite support, but discrete filters use finite kernels
Variance of Gaussian: determines extent of smoothing
Rule of thumb: set filter half-width to about 3σ

we need to produce a discrete approximation to the Gaussian function before we can perform the convolution
The constant term in front of the 1-D Gaussian Kernel is the normalization constant
2
∞ − 𝑥 2𝑑𝑥
−∞
𝑒 2𝜎 = 2𝜋 𝜎
Normalized Kernel: integral over its domain is UNITY for all values of 𝝈

Increasing 𝝈 ? The amplitude is reduced substantially


Parameter σ is the “scale” / “width” / “spread” of the Gaussian kernel, and controls the amount of smoothing
When we convolve two Gaussian kernels we get a new wider
Gaussian with a variance which is the sum of the variances of
the constituting Gaussians:

So the Fourier transform of the Gaussian function is again a Gaussian function, but now of the
frequency w. The Gaussian function is the only function with this property.

Gaussian filtering removes parts of the signal above a certain frequency. Often noise is high frequency and
signal is low frequency
Rotational symmetry • Single lope in both space and frequency
domain • Smoothing is controlled by a single parameter, •
Separable • Will spread impulse and salt & pepper noise
These filters are based on as specific type of image statistics called order statistics

Order statistics filters :

Order statistics is a technique that arranges the entire pixel in sequential order, given an NXN window
the pixel values can be ordered from smallest to the largest.
The window shape does not need to be a square – Special
shapes Special shapes can preserve line structures can preserve
line structures for median filter
Order statistic Filters
Midpoint filter
Median filter 1 
f ( x, y )  max  g ( s , t )  min  g ( s , t )
2  ( s ,t )Sxy 
f ( x, y)  median  g ( s, t )
( s ,t )S xy

( s ,t )S xy
The midpoint filter is most useful for Gaussian and uniform noise.
Max filter
f ( x, y)  max  g ( s, t )
( s ,t )S xy
The minimum filters works best for salt- type noise (High value), and
the maximum filters work best for pepper-type noise
Min filter
f ( x, y)  min  g ( s, t )
( s ,t )S xy

in general a minimum or low rank filter will tend to darken an image


and a maximum or high rank filter will tend to brighten an image.
Median Filtering
Advantages:–Removes impulsive noise –Preserves edges
Disadvantages:–poor performance when no of noise pixels in the
window is greater than 1/2 the no in the window
–poor performance with Gaussian noise
Median Filtering is very effective for
reducing salt and pepper noise

You might also like