Professional Documents
Culture Documents
Ip Unit 3
Ip Unit 3
Ip Unit 3
Periodic noise
Periodic noise can be reduced by
looks like dots setting frequency
In the frequency components
domain corresponding to
noise to zero.
❖ Causes of Image degradation:
1. Noise due to image sensor
2. Blurring due to miss-focus
3. Blurring due to motion
4. Noise from the transmission channel
5. Blur due to transmission channel
6. Atmospheric turbulence
7. Improper opening of closing of camera shutter
where h(x,y) is a system that causes image degradation and ƞ(x,y) is noise.
24
where h(x,y) is a system that causes image degradation and ƞ(x,y) is noise.
❖ Noise and Images
• The sources of noise in digital images arise during image acquisition
(digitization) and transmission
1 − ( z − ) / 2 p( z ) = b
p( z ) =
2 2
e
2 0 for z a
1 Pa for z = a
for a z b
p( z ) = b - a p( z ) = Pb for z = b
0 otherwise 0
otherwise
PDF tells how much each z value occurs.
❖ Noise Example
• The test pattern to the right is
ideal for demonstrating the
addition of noise
• The following slides will show the
result of adding noise based on
various models to this image
25
Periodic Noise, Noise Estimation
and Band Pass/Band Reject
filters and its implementation in
MATLAB © Dr. Dafda
Periodic Noise Reduction by Freq. Domain Filtering
Degraded image DFT
Periodic noise
Periodic noise can be reduced by
looks like dots setting frequency
In the frequency components
domain corresponding to
noise to zero.
where h(x,y) is a system that causes image degradation and ƞ(x,y) is noise.
Spatial filters
ˆf ( x, y ) = 1
g ( s, t )
mn ( s ,t )S xy
Noise is reduced due to blurring
Image
Original
corrupted
image
by AWGN
Image Image
obtained obtained
using a 3x3 using a 3x3
arithmetic geometric
mean filter mean filter
Harmonic and Contraharmonic Filters
Harmonic mean filter
mn Works well for salt noise
fˆ ( x, y ) =
1 but fails for pepper noise
( s ,t )S xy g ( s, t )
g ( s , t ) Q +1
Positive Q is suitable for
fˆ ( x, y ) =
( s ,t )S xy
eliminating pepper noise.
g ( s , t ) Q
Negative Q is suitable for
( s ,t )S xy eliminating salt noise.
Q = the filter order For Q = 0, the filter reduces to an arithmetic mean filter.
For Q = -1, the filter reduces to a harmonic mean filter.
Contraharmonic Filters: Example
Image Image
corrupted corrupted
by pepper by salt
noise with noise with
prob. = 0.1 prob. = 0.1
Image Image
obtained obtained
using a 3x3 using a 3x3
contra- contra-
harmonic harmonic
mean filter mean filter
With Q = 1.5 With Q=-1.5
❖ Non-Linear Order statistics Spatial Filtering:
• Median filtering is a nonlinear method used to remove noise from images.
• It is widely used as it is very effective at removing noise while preserving edges.
• It is particularly effective at removing ‘salt and pepper’ type noise.
• The median filter works by moving through the image pixel by pixel, replacing
each value with the median value of neighboring pixels.
R = median{Zk | k =1,2,3,…..9}
Filter mask
Order-Statistics Filters
Median filter
fˆ ( x, y ) = median g ( s, t )
( s ,t )S xy
Max filter
Min filter
fˆ ( x, y ) = min g ( s, t )
Reduce “bright” noise
(salt noise)
( s ,t )S xy
Midpoint filter
3 4
Image Image
obtained obtained
using a 3x3 using a 3x3
max filter min filter
Alpha-trimmed Mean Filter
Formula:
1
fˆ ( x, y ) =
mn − d
g ( s, t )
( s ,t )S xy
r
Image 2 Image 2
obtained obtained
using a 5x5 using a 5x5
arithmetic geometric
mean filter mean filter
Image 2
obtained
Image 2 using a 5x5
obtained alpha-
using a 5x5 trimmed
median filter mean filter
with d = 5
Alpha-trimmed Mean Filter: Example (cont.)
Image Image
obtained obtained
using a 5x5 using a 5x5
arithmetic geometric
mean filter mean filter
Image
obtained
Image using a 5x5
obtained alpha-
using a 5x5 trimmed
median filter mean filter
with d = 5
27
Finding information from the Finding information from the Finding information from the
observed image. Instrument used for image constructed model
❖ Estimation by Observation:
• Identify the good portion of the image in which the signal content is strong.
• Let the observed sub-image be 𝑔𝑠(𝑥, 𝑦) and let the processed sub-image be
𝑓መ𝑠 𝑥, 𝑦 .
Hs(u,v) = Gs(u,v)/ˆFs(u,v)
• Now we can apply inverse Fourier transform to the above equation and estimate
the degradation function.
❖ Estimation by Experimentation:
• Identify the instrument used for obtaining the image and study the device settings.
• Obtain the impulse response of the degradation by imaging an small white
dot(impulse) using the same system settings.
• But the Fourier transform of an impulse is constant. So,
H(u,v) = G(u,v)/A
• Now as the effect of noise on impulse is negligible, we can apply inverse Fourier
transform to the above equation and estimate the degradation function.
❖ Estimation by Modelling:
• Using the mathematical models, the degraded function like motion blur,
atmospheric turbulence etc. can be estimated.
• Now there are three possibilities:
1. Complete knowledge about the blur is available. Then we can apply Inverse
filtering(deconvolution).
2. Partial knowledge about the blur is available. Weiner filter can be used in this
case.
3. No knowledge about the blur is available. Blind deconvolution is applied in this
case.
28
Inverse Filtering in Digital Image
Processing and its
implementation in MATLAB
© Dr. Dafda
❖ Estimation by Modelling:
• Using the mathematical models, the degraded function like motion blur,
atmospheric turbulence etc. can be estimated.
• Now there are three possibilities:
1. Complete knowledge about the blur is available. Then we can apply Inverse
filtering(deconvolution).
2. Partial knowledge about the blur is available. Weiner filter can be used in this
case.
3. No knowledge about the blur is available. Blind deconvolution is applied in this
case.
❖ Model of Image degradation and restoration process
where h(x,y) is a system that causes image degradation and ƞ(x,y) is noise.
❖ Inverse filtering:
• If we want to get rid of the blurring and noise, the simplest method is by applying
inverse filtering (deconvolution). Blurring is smoothing/LPF, so de-blurring is
sharpening/HPF and hence inverse filter acts as a HPF (also noise will increase).
• The input image gets convolved by a blurring function h(x,y) and changes to
g(x,y). So to retrieve f(x,y) from g(x,y), we take the inverse of h(x,y).
• Assuming that the noise is zero,
F(u,v) = G(u,v) / H(u,v)
Let HI(u,v) = 1 / H(u,v),
So, F(u,v) = HI(u,v) . G(u,v)
• Taking the inverse Fourier transform of the above equation,
f(x,y) = hI(x,y) * g(x,y)
• This shows that if we convolve the blurred image with the inverse of blurring
function, we get back the original image.
• But if the noise term is also present,
• If H(u,v) is zero, the second term N(u,v)/H(u,v) can have large values resulting in
amplification of noise as it tends to infinity.
• Therefore inverse filtering is not used in its original form and we have to go for
Wiener filter.
29
Wiener Filter in Digital Image
Processing and its
implementation in MATLAB
© Dr. Dafda
❖ Model of Image degradation and restoration process
where h(x,y) is a system that causes image degradation and ƞ(x,y) is noise.
❖ Wiener Filter:
• Wiener filter uses the statistical properties of the image and can be
used to restore images in the presence of blur as well as noise.
• Wiener filter was proposed by N. Wiener in 1942. It is also called
Minimum Mean Square Error Filter or Least Square Error Filter.
• Here the goal is to find an estimate of the restored image such that the
mean square error between restored image and uncorrupted image is
minimized.
• This means it minimizes the overall mean square error in the process
of inverse filtering and noise smoothing.
• Wiener filter gives an linear estimation of the original uncorrupted
image.
❖ Wiener Filter: Minimum Mean Square Error Filter
Objective: optimize mean square error:
Wiener Filter Formula:
e2 = E ( f − fˆ )2
H *
( u , v ) S ( u , v )
Fˆ (u, v ) = f
G ( u , v )
S f (u, v ) H (u, v ) + S (u, v )
2
where
H * ( u, v ) f = uncorrupted image
= G ( u , v )
H (u, v ) + S (u, v ) / S f (u, v )
2
fˆ = estimate of f
e = error measure
1 H ( u, v )
2
= G ( u , v ) E{·} = expected value
H (u, v ) H (u, v ) + S (u, v ) / S f (u, v )
2
H(u,v) = Degradation function
H*(u,v) = complex conjugate of H(u,v)
׀H(u,v)׀2 = H*(u,v). H(u,v)
Sn(u,v) = ׀N(u,v)׀2 = Power spectrum of noise
Sf(u,v) = ׀F(u,v)׀2 Power spectrum of undegraded
image
❖ Approximation of Wiener Filter
Wiener Filter Formula:
1 H ( u , v )
2
Fˆ (u, v ) = G (u, v )
H (u, v ) H (u, v ) + S (u, v ) / S f (u, v )
2
Difficult to estimate
Approximated Formula:
1 H ( u , v )
2
Fˆ (u, v ) = G ( u , v )
H (u, v ) H (u, v ) + K
2
where h(x,y) is a system that causes image degradation and ƞ(x,y) is noise.
❖ Constrained Least Squares Filtering (CLSF):
• Wiener filter is not optimal when no information on the power spectra is
available.
• For Wiener filters, the power spectra of the undegraded image(Sf) and
noise(Sn) must be known/assumed.
• CLSF does not make any assumption about original image, and only makes
use of mean and variance of the noise.
• The method to improve the Wiener filter is to impose a constraint on the
mean square error term. Hence CLSF is an advanced version of the Wiener
filter, where we do not need the knowledge of Sf and Sn; and some
constraint is added to the least square filtering.
• The CLSF algorithm yields optimal result for each image to which it is
applied.
Constrained Least Squares Filter
Degradation model: Written in a matrix form
g ( x, y ) = f ( x, y ) h ( x, y ) + ( x, y ) g = Hf + η
Objective: to find the minimum of a criterion function
M −1 N −1
C = f ( x, y ) 2 2
x =0 y =0
Subject to the constraint,
2 where w = wT w
2
g − Hfˆ = η
2
where 0 −1 0
P (u,v) = Fourier transform of p(x,y) = − 1 4 − 1
0 − 1 0
Constrained Least Squares Filter: Example
Result of the Result of the
Image Constrained Wiener filter
degraded Least square
filter
by motion
blur +
2=650
AWGN
2=325
2=130
Constrained Least Squares Filter: Adjusting
Define It can be shown that
( ) = r T r = r
2
r = g − Hfˆ
We want to adjust gamma so that
r = η a
2 2
1
3. Stop if 1 is satisfied
Otherwise return step 2 after increasing if r η −a
2 2
or decreasing if r η +a
2 2
For computing 2
R(u, v) = G(u, v) − H (u, v ) Fˆ (u, v) r
M −1 N −1
1
r = ( x, y )
2 2
r
MN x =0 y =0
M −1 N −1
1
m =
MN
( x, y )
x =0 y =0
( x, y ) − m
M −1 N −1
1 For computing 2
=
2 2
η
MN x =0 y =0
η = MN 2 − m
2
Constrained Least Squares Filter: Example
Use correct noise
Original image Correct parameters:
parameters
Initial = 10-5
Correction factor = 10-6
a = 0.25
2 = 10-5
• Wiener(MMSE) is optimal in the average sense while CLSF yields optimal result
to each image to which it is applied.
• When noise is low, both MMSE and CLSF generate equal results, but when
noise is high CLSF is advantageous if proper is selected. Because it is easier to
select scalar value of rather than to approximate the K which is never constant.