Professional Documents
Culture Documents
Name of Faculty:
Dr. Umesh Sahu
(Assistant Professor)
Manipal Institute of Technology, Manipal, India
−1−
Syllabus
Image acquisition and pre-processing: [15]
Vision system components, Image acquisition and analysis, Image
formation - Sampling & Quantization, simple operations on image,
Image enhancement: Spatial Domain and frequency domain
methods, Image noise, image restoration , morphological
operations, Segmentation, image analysis, representation of regions,
Feature extraction, fundamentals of color image processing,
conversion of color spaces.
Gaussian Rayleigh
models for the image
noise term η(x, y):
– Gaussian
• Most common model Erlang Exponential
– Rayleigh
– Erlang (gamma)
– Exponential Uniform
– Uniform Impulse
– Impulse
• Salt and pepper noise
10
of
31
Noise Example
The test pattern to the right is
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Histogram
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
11
31
Gaussian
Rayleigh
Erlang
Example 5.1
Noise Example (cont…)
12 Try out !!
of
31
Noise Example (cont…) Write a function to add uniform,
gaussian, salt and pepper,
Rayleigh, exponential and
erlang noise and analyze its
histogram
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Hint:
Refer page 112/344 (pp 148 of
Rafael C. Gonzalez - Digital
Image Processing Using MATLAB
(R)-Prentice Hall (2003)
fˆ ( x, y ) =
g ( s ,
( s ,t )S xy
t ) Q
Image
Original Corrupted
Image By Gaussian
Noise
Example 5.2
21
of
31
Noise Removal Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image
Corrupted
By Pepper
Noise
Result of
Filtering Above
With 3*3
Contraharmonic
Q=1.5
22
of
31
Noise Removal Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image
Corrupted
By Salt
Noise
Result of
Filtering Above
With 3*3
Contraharmonic
Q=-1.5
23
of
31
Contraharmonic Filter: Here Be Dragons
Min Filter:
fˆ ( x, y ) = min {g ( s, t )}
( s ,t )S xy
Image Result of 1
Corrupted Pass With A
By Salt And 3*3 Median
Pepper Noise Filter
Result of 2 Result of 3
Passes With Passes With
A 3*3 Median A 3*3 Median
Filter Filter
Example 5.3
30
of
31
Noise Removal Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Image Image
Corrupted Corrupted
By Pepper By Salt
Noise Noise
Result Of Result Of
Filtering Filtering
Above Above
With A 3*3 With A 3*3
Max Filter Min Filter
Example 5.3
31
of
31
Noise Removal Examples (cont…)
Image Image Further
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Corrupted Corrupted
By Uniform By Salt and
Noise Pepper Noise
Filtered By Filtered By
5*5 Arithmetic 5*5 Geometric
Mean Filter Mean Filter
Filtered By Filtered By
5*5 Median 5*5 Alpha-Trimmed
Filter Mean Filter
Example 5.3
32
of
31
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
• We will take a look at the adaptive
median filter
33
of
31
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
34
of
31
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
35
of
31
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 ≤ repeat Smax level A
Else output zmed
Level B: B1 = zxy – zmin
B2 = zxy – zmax
If B1 > 0 and B2 < 0, output zxy
Else output zmed
36
of
31
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
37
of
31
Adaptive Filtering Example
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Example 5.5
Content:
▪Image Restoration
–What is image restoration?
–Noise and images
–Noise models
–Noise removal using spatial domain filtering
–Periodic noise
–Noise removal using frequency domain filtering
electrical or electromagnetic
interference
• Gives rise to regular noise
patterns in an image
• Frequency domain
techniques in the Fourier
domain are most effective at
removing periodic noise
40
of
31
Band Reject Filters
Removing periodic noise form an image involves
removing a particular range of frequencies from that
image
Band reject filters can be used for this purpose
An ideal band reject filter is given as follows:
W
1 if D(u , v) D0 − 2
W W
H (u, v) = 0 if D0 − D(u, v) D0 +
2 2
1 if D(u , v) D0 + W
2
41
of
31
Band Reject Filters (cont…)
The ideal band reject filter is shown below,
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
2) Bandpass Filters
Hbp(u,v)=1-Hbr(u,v)
3) Notch Filters
0 if D1 (u , v ) D 0 or D 2 (u, v ) D 0
3-1) Ideal : H(u, v ) =
1 otherwise
1
2
22
D1 (u, v ) = u − − u 0 + v − − v 0
M N
2 2
1
2
22
D1 (u, v ) = u − + u 0 + v − + v 0
M N
2 2
The center of the frequency rectangle has been shifted to the point
(M/2,N/2)
45
of
Periodic Noise Reduction by Frequency
31 Domain Filtering
H(u , v ) =
1
3-2) Butterworth
n
D02
of order n : 1+
D1 (u, v ) D 2 (u , v )
1 D1 (u , v ) D 2 (u , v )
−
3-3) Gaussian : H(u, v ) = 1 − e
2 2
D0
46
of
Periodic Noise Reduction by Frequency
31 Domain Filtering
47
of
Periodic Noise Reduction by Frequency
31 Domain Filtering
Example 5.8
48
of
Periodic Noise Reduction by Frequency
31 Domain Filtering
f (x , y ) = g (x , y ) − w (x , y ) (x , y )
(x , y ) = F H(u, v )G (u, v )
−1
g (x , y )(x , y ) − g (x , y ) (x , y )
w (x , y ) =
(x , y ) − (x , y )
2 2
Example 5.9
51
of
Periodic Noise Reduction by Frequency
31 Domain Filtering
52
of
Periodic Noise Reduction by Frequency
31 Domain Filtering
Image Noise, Image Restoration : MATLAB
J = imnoise(I,'gaussian')
J = imnoise(I,'gaussian',m)
J = imnoise(I,'gaussian',m,var_gauss)
J = imnoise(I,'localvar',var_local)
MATLAB
J = imnoise(I,'localvar',intensity_map,var_local)
DEMO
J = imnoise(I,'poisson')
J = imnoise(I,'salt & pepper')
J = imnoise(I,'salt & pepper',d)
J = imnoise(I,'speckle')
J = imnoise(I,'speckle',var_speckle)
https://in.mathworks.com/help/images/ref/imnoise.html#:~:text=example-
,J%20%3D%20imnoise(%20I%20%2C'salt%20%26%20pepper'%2C,mean%200%20and%20variance%200.05.