Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 39

Digital Image

Processing
Restoration of noise-only degradation

Filters to be considered

2
Restoration using Spatial Filtering
We can use spatial filters of different kinds to remove different
kinds of noise.

Arithmetic Mean Filter


Let Sxy represents the set of coordinates in a rectangular sub
image window of size m x n centred at (x, y).
g(s,t) – Degraded Image
This filter computes the average value of the corrupted image
in the area defined by Sxy.

ˆ 1
f (x, y)  mn (s,t )S  g(s,t)
xy

Implemented as simple
smoothing filter
Well Suited for Gaussian / Uniform Noise
Geometric Mean Filter

Each restored pixel is given by the product of the pixels in the


sub image window, raised to the power 1/mn.

Achieves smoothing comparable to Arithmetic Mean Filter but


tends to lose less image details in the process.

Well Suited for Gaussian / Uniform Noise


1

  mn
ˆ
f (x, y)    g(s,
 ( s,t )S


t)  xy

Harmonic Mean Filter

Works well for salt noise but fails for pepper noise.

Also does well for Gaussian Noise

mn
fˆ(x, y)  1
 g(s,t)
(s,t ) xy
S
Example:

Image
Original Corrupted
By Gaussian
Image Noise

After A After A
3*3 3*3
Arithmetic Geometric
Mean Filter Mean Filter
Contra-harmonic mean filter

7
Classification of contra-harmonic filter applications

8
Contra-harmonic mean filter (example)

9
Order Statistic Filter

Result is based on the ranking / ordering of the pixels


contained
in the image area encompassed by the filter.
Median Filter

fˆ(x, y)  median{g(s, t)}


( s,t )S xy

Effective for both uni-polar and bipolar impulse noise.

Excellent at noise removal, without the smoothing effects that


can occur with other smoothing filters
Example: Median Filter
Median filter (Example)

12
Max and Min filter

– Max filter also known as 100th percentile filter


– Min filter also known as zeroth percentile filter
– Max filter helps in removing pepper noise
– Min filter helps in removing salt noise 13
Midpoint filter

– Calculates the average of the highest and lowest pixel


values within a window

14
Alpha-Trimmed Mean Filter

• Alpha-trimmed mean filter is windowed filter of nonlinear class, by its


nature is hybrid of the mean and median filters.
• The basic idea behind filter is for any element of the signal (image) look at its
neighborhood, discard the most atypical elements and calculate mean value
using the rest of them.
• Alpha you can see in the name of the filter is indeed parameter responsible
for the number of trimmed elements.
 Alpha-Trimmed Mean Filter:

1
ˆ
f (x, y)  mn  g r (s,t)
(s,t )S xy

 Here deleted the α/2 lowest and  highest grey levels, so g (s, t) represents
α/2 r
the remaining mn – α pixels
Alpha-Trimmed Mean Filter

 Alpha-trimmed mean filter algorithm:


 Place a window over element;
 Pick up elements;
 Order elements;
 Discard elements at the beginning and at the end of the
got ordered set;
 Take an average— sum up the remaining elements and
divide the sum by their number.
Result: Alpha-Trimmed Mean Filter
Example:

Image Result of 1
Corrupted Pass With A
By Salt And 3*3
Pepper Noise Median
Filter

Result of 2 Result of 3
Passes With Passes With
A 3*3 Median A 3*3 Median
Filter Filter
Example:

Image
Image Corrupted
By Salt
Corrupted Noise
By
Pepper
N
oise
Result Of
Result Of
Filtering
Filtering
Above
Above
With A
With A
3*3 Min
3*3 Max
Filter
Filter
Example (Combined):
Image Image Further
Corrupted Corrupted
By Uniform By Salt and
Noise Pepper Noise

Filtered By Filtered By
5*5 5*5 Geometric
Arithmetic Mean Filter
Mean Filter

Filtered By Filtered By
5*5 Median 5*5 Alpha-
Filter Trimmed Mean
Filter
Adaptive Filters

• The filters discussed so far are applied to an entire


image without any regard for how image
characteristics vary from one point to another

• The behaviour of adaptive filters changes depending


on the characteristics of the image inside the filter
region
Adaptive Median Filtering

• The median filter performs relatively well on impulse noise as


long as the spatial density of the impulse noise is not large

• The adaptive median filter can handle much more spatially


dense impulse noise, and also performs some smoothing for
non-impulse noise

• The key insight in the adaptive median filter is that the filter
size changes depending on the characteristics of the image
Adaptive Median Filtering (cont…)

Remember that filtering looks at each original pixel image in turn


and generates a new filtered pixel
First examine the following notation:
zmin = minimum grey level in Sxy
zmax = maximum grey level in Sxy

zmed = median of grey levels in Sxy

Zxy = grey level at coordinates (x, y)

Smax =maximum allowed size of Sxy


Adaptive Median Filtering (cont…)

Level A: A1 = zmed – zmin


A2 = zmed – zmax
If A1 > 0 and A2 < 0, Go to level B
Else increase the window size
If window size ≤ Smax repeat level A
Else output zmed
Level B: B1 = zxy – zmin
B2 = zxy – zmax
If B1 > 0 and B2 < 0, output zxy
Else output zmed
Adaptive Median Filtering (cont…)

The key to understanding the algorithm is to


remember that the adaptive median filter has three
purposes:
Remove impulse noise
Provide smoothing of other noise
Reduce distortion
Adaptive Filtering Example

Image corrupted by salt Result of filtering with a 7 Result of adaptive


and pepper noise with * 7 median filter median filtering with i = 7
probabilities Pa = Pb=0.25
Periodic Noise

Typically arises due to electrical / Electro- mechanical interference


during image acquisition.

 Spatially dependent noise.

 Can be reduced significantly via Frequency Domain Filtering.

 Parameters can be estimated by inspecting the Frequency Spectrum


of the image.

Periodic noise tend to produce frequency spikes


Periodic Noise Reduction by Frequency Domain Filtering

Removing periodic noise form an image involves removing


a particular range of frequencies from that image

 Bandreject Filter
 Bandpass Filters
 Notch Filter
Bandreject Filter
A band reject filter blocks frequencies within the chosen range and lets
frequencies outside of the range pass through.
Removes / Attenuates a band of frequencies about the origin of the
Fourier Transform.

Ideal Bandreject Filter:


W
1 if D(u, v)  0
D 2
 W W
H (u, v) 
if D0   D(u, v)  D0 
0 2 2
W
1 if D(u, v)  D0 
2
D(u, v) = Distance of point from the

origin W = Width of the band
D0 = Radial Centre
Butterworth Bandreject Filter:

Gaussian Bandreject Filter:


Ideal Band Butterworth Gaussian
Reject Filter Band Reject Band Reject
Filter (of order 1) Filter
Example:

Image corrupted Fourier spectrum


by sinusoidal of corrupted
noise image

Butterworth band Filtered image


reject filter
Band Pass Filtering
w
0 D(u,v)  D0 - 2

H(u,v) = 1 D0- w
2
 D(u,v)  D0 + w2
w
0 D(u,v) > D0 + 2

D(u,v) =  u2 + v2
D0 = cut off frequency
w = band width
H(u,v) H(u,v)

1
v
D(u,v)
0 D0- w D0 D0+w
2 2
u

Bandpass filters are a combination of both lowpass and highpass filters. They attenuate


all frequencies smaller than a frequency and higher than a frequency. , while the
frequencies between the two cut-offs remain in the resulting output image
Band-Pass Filters (cont...)

Band-pass and Band-stop Filters


Inverse Filtering

An approach to restore an image.

Compute an estimate F’( u, v) of the transform of the original image


by:

Divisions are made between individual elements of the


functions.
Inverse
Filtering…

Even if we know degradation function, we can not recover the


undegraded
image [Inverse Fourier Transform of F(u, v)] exactly because

N(u, v) is random function whose Fourier Transform is not known.

If degradation has ZERO or less value then N(u, v) / H(u, v) dominates


the estimated F’(u, v).

No explicit provision for handling Noise.


Maximum Mean Square Error (Wiener) Filtering

 Incorporates both degradation function and statistical characteristics


of noise into restoration process.
 Considers images and noise as random process.

 Find an estimate f’ of the uncorrupted image f such that mean square


error
between them is minimized. Error measure is given by:

 E{.} = Expected value of the argument


 Assumptions:
 image and noise are uncorrelated.
 One or other has Zero mean
 Gray levels in the estimate are a linear function of levels in the
degraded image.
Maximum Mean Square Error (Wiener)
Filtering…
 Based on these conditions:
original, f degraded: g

20 20

40 40

THANK
60 60
20 40 60 20 40 60
inverse filter Wiener filter, K=0.2

20 YOU 20

40 40

60 60
20 40 60 20 40 60

You might also like