Digital Image Processing_3 Unit_ ASRao
Digital Image Processing_3 Unit_ ASRao
ASRao 5
Properties of Noise
• Noise is very difficult to remove it from the digital images without the
prior knowledge of noise model.
g ( x, y ) f ( x, y ) ( x, y )
where
f(x, y) - Original Image η(x, y) – Noise g(x,y) – Noisy image
Rayleigh Noise
Uniform Noise
Exponential Noise
1 ( z ) 2 / 2 2
p( z ) e
2
The test pattern shown here is ideal for demonstrating the addition of
noise.
Image Degradation with Additive Noise
ASRao 22
Model for Image Degradation/Restoration Process
ASRao 25
The definition indicates that the response at any point in the image
depends only on the value of the input at that point, not on its position.
ASRao 26
Estimation of Degradation Model
Degradation comes in many forms such as motion blur, noise and camera
misfocus.
Degradation model:
ASRao 29
Estimation by Observation
Let the image is degraded by an unknown degradation function H.
Using the sample gray levels of the object and background, we can
construct an un-blurred image of the same size and characteristics as
the observed sub-image.
Then we can extend the transfer function to the whole image.
Gs (u, v)
H s (u, v)
Fs (u, v)
Based on the information of Position invariance, we can deduce
complete degradation function H(u,v) from the characteristics of
above function
Suppose the radial plot of Hs(u,v) has the approximate shape of the
Gaussian curve , same information is used for H(u,v) in the larger scale.
ASRao 32
Estimation by Experimentation
G(u, v)
H (u, v)
A
Where A is constant describing strength of the impulse.
ASRao 34
Estimation by Mathematical Model
In some cases, the model can even take environmental conditions that
cause degradation.
Algebraic approaches
Unconstrained Optimization
Constrained Optimization
Frequency Domain
Inverse Filter
Wiener (minimum mean square error) filter
ASRao 37
Algebraic Approach to Restoration
Algebraic methods are very popular for image restoration because it
uses the concept of matrices and linear algebra instead of those
integrals.
The objective of image restoration is to estimate the original image, f
from the degraded image, g using some knowledge or assumption
about H and η.
fˆ an estimate ,
The objective of algebraic approach is to seek of the
original image, f from the degraded image, g such that a predefined
criterion function is minimized.
Unconstrained Method of Restoration
This approach has no constraints .
Here the approximate image of the original image is recovered by
minimizing the noise.
The basic image degradation model
g Hf n (1)
In the absence of any knowledge about the noise, h, the objective of
unconstrained restoration is to seek an estimate, of the original image, f
from the degraded image, g such that Hfˆ approximates g and the norm
of the noise term is minimized. That is fˆ is found such that
2
g Hfˆ
2
( 2) is minimum, where
T , norm of
2
g Hfˆ
2
g Hfˆ g Hfˆ ,
T
norm of g Hfˆ
2H g Hfˆ 0 (3)
2
T
fˆ
solving equation (3) for fˆ
fˆ H 1 g ( 4)
The frequency domain representation of Equation (4) is
G (u , v)
Fˆ (u , v) (5)
H (u , v)
ˆ G (u , v) N (u , v)
F (u , v) (6)
H (u , v) H (u , v)
where N (u , v) is the Fourier transform of the noise, .
g Hf n (1)
The objective of constrained restoration is to seek an estimate, fˆ of the
original image, f from the degraded image, g such that the criterion
function
2 2
J ( fˆ ) Qf g Hfˆ
2
(2)
is minimum. The basic image degradation model
T , norm of
2
g Hfˆ
2
g Hfˆ g Hfˆ ,
T
norm of ( g Hfˆ )
fˆ H T H QT Q
1
H T g ( 4)
where
1 /
Mathematically:
Degraded Image = Original Image * PSF
Restored Image = Degraded Image * (1/PSF)
where * represents the convolution operation.
ASRao 47
ASRao 48
ASRao 49
ASRao 50
ASRao 51
ASRao 52
ASRao 53
Least Mean Square Filtering (Wiener Filter)
The Wiener filter is one approach which makes use of knowledge of the
statistical properties of the noise besides the degradation function.
A Wiener filter is a linear filtering method used to restore images that
have been degraded by both noise and blurring. It attempts to remove
both noise as well as the blur.
It's one of the first methods developed to reduce random noise in
images.
Wiener filtering was one of the first methods developed to reduce
additive random noise in images.
It works on the assumption that additive noise is a stationary random
process, independent of pixel location; the algorithm minimizes the
square error between the original and reconstructed images.
The Weiner filter was proposed by Norbert Wiener in 1940. It was
published in 1949.
Wiener filter is not an adaptive filter
ASRao 54
as it assumes input to be stationary.
The Wiener filter works by:
2
ˆ 2
e E f f
where E is the Expected value.
ASRao 55
More details about the Wiener filter:
Assumptions
The Wiener filter assumes that the image and noise are random processes
that are uncorrelated and have known power spectra.
• f and n are uncorrelated
• f and/or n is zero mean
• gray levels in fˆ are a linear function of gray levels in f
Calculation
The Wiener filter is usually applied in the frequency domain. The Discrete
Fourier Transform (DFT) is used to obtain the image spectrum, which is then
multiplied by the Wiener filter. The inverse DFT is then used to obtain the
image estimate.
Performance
The Wiener filter is known for its performance in denoising white noise. It
performs better than other non-linear filters for images corrupted by white
noise. ASRao 56
The Fourier transform of the correlation is Power Spectral Density (PSD).
Let the PSD of the input image f(x,y) is Sf(u,v) and noise n(x,y) is Sn(u,v).
g ( x, y ) (h * f )( x, y ) ( x, y )
G (u , v) H (u , v) F (u , v) N (u , v)
ASRao 57
Multiply numerator and denominator by H(u,v)
ASRao (a)
58
At frequencies (u,v) where the signal is much stronger than the noise, the
ISNR is 0, and the Wiener filter reduces to the inverse filter.
At frequencies (u,v) where the signal is much weaker, the ISNR will be
large and the corresponding component G(u,v) will be attenuated
(note that the Wiener filter cannot reconstruct such components well)
When there is no blurring, but only noise, we have:
Why? Images typically have high energy at lower frequencies, and low
energy at higher frequencies. But noise is typically spread-spectrum.
If the original image Sf(u,v) is unknown, equation (a) can be written as:
ASRao 60
Limitations of Wiener Filter
Requires a priori knowledge: Wiener filters require accurate knowledge of
the input signal, noise signal, and true signal's power spectra. This can be
difficult to obtain, especially when the signal or noise is non-stationary or
non-Gaussian.
Linear: Wiener filters are linear, so they can't handle nonlinear phenomena
like harmonics, clipping, or intermodulation.
Low accuracy: Wiener filters have high computation speed but low
accuracy, which can cause problems for quantitative computation.
ASRao 61
1. Assumes Stationary Noise: Wiener filter assumes that the noise is
stationary, meaning it doesn't change over time. If the noise is non-
stationary, the filter may not work well.
2. Requires Accurate Noise Model: Wiener filter needs an accurate model
of the noise to work effectively. If the noise model is incorrect, the filter
may not perform well.
3. Sensitive to Filter Parameters: Wiener filter's performance depends on
the choice of filter parameters. If these parameters are not chosen
correctly, the filter may not work well.
4. Not Effective for Non-Linear Distortions: Wiener filter is designed to
handle linear distortions, but it may not be effective for non-linear
distortions.
5. Computational Complexity: Wiener filter can be computationally
intensive, especially for large images or signals.
6. Assumes Gaussian Noise: Wiener filter assumes that the noise is
Gaussian, which may not always be the case. If the noise is non-Gaussian,
the filter may not work well.
ASRao 62
ASRao 63
Constrained Least Square Filtering
Constrained least squares filtering (CLS) is an image processing technique
that reduces noise and degradation in an image
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 require 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.
ASRao 64
Degradation model: g(x,y) = f(x,y) * h(x,y) + η(x,y)
M 1N 1 2
C 2 f ( x, y )
x 0 y 0
2
g Hfˆ
2
Subject to the constraint, (b)
The issue over here is to find the sensitivity of H to η i.e., blur to noise
and to solve this issue, we provide a constraint to the smoothing by using
the Laplacian operator that is second order derivative. Hence the
objective is to find the minimum of the criterion function given by C
which is equal to the Laplacian operator.
The solution of this problem in frequency domain is
H *
(u , v)
ˆ
F (u , v) G (u , v)
H (u , v) P (u , v)
2 2
when γ =0, constrained least square filter reduces to Inverse filter, i.e.,
ˆ G (u , v)
F (u , v)
H (u , v)
It is easier to select the scalar value for γ than to approximate the SNR
which is seldom constant.
ASRao 67
Image degraded by
Motion Blur + AWGN
Q ( ) T
2
If a=0, 2
n
2
and the constrained in equation (b) will be satisfied.
ASRao 69
1. Specify an initial value of γ
2
2. Compute
2 2
otherwise return to step 2 after increasing γ if n a
2 2
or decreasing γ if n a
H *
(u , v )
Fˆ (u , v) G (u , v)
H (u , v) P (u , v)
2 2
ASRao 70
C L S F Vs M M S E
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.
Advantages
Only mean and variance of the noise are required to be known to
implement this method.
For each input image it produces ASRao
an optimal result. 71
ASRao 72
Interactive restoration is a technique used in digital image processing to
remove noise, defects, or unwanted features from an image. This
process involves human interaction and feedback to achieve the desired
outcome.
ASRao 73
Steps involved in Interactive Restoration
1. Image acquisition: The image to be restored is acquired and loaded into
the system.
2. Pre-processing: The image may undergo pre-processing steps such as
resizing, cropping, or converting to a suitable format.
3. Defect detection: The user identifies the defects or unwanted features
in the image.
4. Restoration: The user applies restoration techniques, such as filtering,
inpainting, or texture synthesis, to correct the defects.
5. Feedback and refinement: The user reviews the restored image and
provides feedback. The restoration process is refined based on this
feedback.
6. Final output: The final restored image
ASRao is generated. 74
Practical Examples
1. Noise removal: A user wants to remove noise from a digital image of a
landscape. They use an interactive restoration tool to select the noisy
areas and apply a noise reduction filter.
2. Scratch removal: A user wants to remove scratches from an old
photograph. They use an interactive restoration tool to select the
scratched areas and apply an inpainting algorithm to fill in the missing
information.
3. Text removal: A user wants to remove unwanted text from an image.
They use an interactive restoration tool to select the text and apply a
texture synthesis algorithm to replace it with a matching background
texture.
ASRao 75
Tools and Techniques
1. Image editing software: Adobe Photoshop, GIMP, etc.
2. Interactive restoration tools: Inpainting tools, texture synthesis tools,
etc.
(1)
ASRao (2)77
The Fourier transform of 2D Sine function is a pair of impulses of strength
–A/2 and +A/2 located at coordinates (uo/2π. Vo/2π) and (-uo/2π. -Vo/2π)
of frequency plane.
The transform has only imaginary component . If the degradation
considered is additive noise then the degraded image can be written as
~ 2
fˆ ( x m, y n) fˆ ( x, y )
1 x y
2 ( x, y )
(2 x 1)(2 y 1) m x n y
(6)
where
~
fˆ ( x, y ) is the average value of fˆ ( x, y ) in the neighborhood
ASRao 79
fˆ ( x, y )
1 x y
fˆ ( x m, y n)
(2 x 1)(2 y 1) m x n y
(7)
Sub equation 5 in equation 6
g ( x m, y n)
1 x y
( x, y )
2
w( x, y ) f ( x m, y n)
(2 x 1)(2 y 1) m x n y ~
~
g ( x , y ) w( x , y ) f ( x , y )
(8)
~ ~
g ( x, y ) f ( x, y ) g ( x, y ) f ( x, y )
w( x, y ) ~2
f ( x, y ) f ( x, y )
2
(9)
ASRao 80
~
To obtain the restored image f ( x, y ) the weighted function w(x,y) is
computed . Generally w(x,y) is computed for one point in each non-
overlapping neighborhood and then used to process all the image points
in that neighborhood.
ASRao 81
ASRao 82