10. Spatial filtering
10. Spatial filtering
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?
𝝈 = 𝟏 𝑮𝒂𝒖𝒔𝒔𝒊𝒂𝒏 𝒇𝒊𝒍𝒕𝒆𝒓
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 𝝈
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 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