0% found this document useful (0 votes)
13 views98 pages

Unit 3

The document discusses image degradation and restoration. It describes how an original image gets degraded through a degradation function and additive noise to produce a degraded image. It then discusses various noise models and methods for estimating noise parameters from images. The goal of image restoration is to recover an estimate of the original image from the degraded observed image. Common restoration filters like mean filters are also described.

Uploaded by

eshaanmishra304
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views98 pages

Unit 3

The document discusses image degradation and restoration. It describes how an original image gets degraded through a degradation function and additive noise to produce a degraded image. It then discusses various noise models and methods for estimating noise parameters from images. The goal of image restoration is to recover an estimate of the original image from the degraded observed image. Common restoration filters like mean filters are also described.

Uploaded by

eshaanmishra304
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 98

21CSE251T-DIP

UNIT-III

Dr.V.Angayarkanni
Image degradation
• The purpose of image restoration is to restore a degraded / distorted image to
its original content and quality

• The degradation function together with an additive noise term, operates on


an input image f(x,y) to produce a degraded image g(x,y)

Dr.V.Angayarkanni
Image degradation model
• The objective of restoration is to get an estimate f^(x,y) of the original image from g(x,y),
the noise term η(x,y) and the degradation function H

• The closeness of the restored image to the original image mainly depends on H & η

• The noise η is unknown, only its statistical property can be learnt

Dr.V.Angayarkanni
Dr.V.Angayarkanni
• If H is a linear and position invariant process, then the degraded image in the
spatial domain is given by

g(x,y) = h(x,y) * f(x,y) + η(x,y)

• Where h(x,y) is the spatial representation of the degradation function

• In the frequency domain

G(u,v) = H(u,v) F(u,v) +


N(u,v)

Dr.V.Angayarkanni
g(x,y) = h(x,y) * f(x,y) + η(x,y)

G(u,v) = H(u,v) F(u,v) +


N(u,v)
Dr.V.Angayarkanni
Image Restoration
• We should have some prior knowledge about the degragation process.

• For this we need


• model for degragation

• original image

• Noise
• Eventhough we may not know the original image, some information such as
power spectral density (PSD) and autocorreletion function (ACF) are easy to
model.

Dr.V.Angayarkanni
Discrete degradation
model
• Let f(x) & h(x) be arrays of dimension A & B respectively for a digital image,
sampled uniformly

• The discrete variable range for f(x) is 0,1,2,…..,A-1 &

The discrete variable range for h(x) is 0,1,2,…..,B-1

• To avoid overlapping, a common period M > A + B – 1 is chosen and zeroes are


appended, if required

Dr.V.Angayarkanni
• For the extended function the convolution expression is

For x = 0,1,2,…..,M-1

• G = H f, where f & g are M dimensional column vectors

and

Dr.V.Angayarkanni
• And H is the M x M matrix given by

• Since he(x) is periodic, he(x) = he(M+x). Therefore,

Dr.V.Angayarkanni
• Here the rows are related by a circular shift to the right
• i.e. the ith row element can be obtained from the i-1th row by shifting the

elements circularly by one position

• i.e. each row is a circular shift of the preceding row

• Such a matrix is called Circulant Matrix

Dr.V.Angayarkanni
Enhancement vs Restoration
Image Enhancement

• A process that improves bad images so that they


look better

Image Restoration

• A process that aims to invert known degradation


operations applied to images
Dr.V.Angayarkanni
Image Enhancement

• Better visual
representation

• Subjective

• No quantitative
measure

Image Restoration Dr.V.Angayarkanni


An Impulse of light Degraded impulse

Dr.V.Angayarkanni
Noise Models
• The main sources of noise in digital images
arise during image acquisition (digitization) and / or
transmission

• Spatial property of refers to the correlation of noise with


the image

• Frequency property refers to the frequency content in the


noise and not the electromagnetic portion
Dr.V.Angayarkanni
• When the Fourier spectrum noise is constant, it is called
White noise

• Except the spatially periodic noise, we assume that noise is


independent of spatial co-ordinates and that it is
uncorrelated with the image
• i.e. there is no correlation between pixel values of the image and
that of the noise

Dr.V.Angayarkanni
Dr.V.Angayarkanni
Blurred Image Blurred Image + Additive Noise

Dr.V.Angayarkanni
Gaussian White Noise

Dr.V.Angayarkanni
Noise Probability Density
Functions

• The spatial noise descriptors is the stastical behaviour of


the gray level values in the noise component

• These are considered random variables with a


characteristic pdf

Dr.V.Angayarkanni
• Gaussian Noise

• The PDF of a Gaussian random variable z is

• Where z is the gray level

• μ is the average value of z


• σ2 is the variance

• About 70 % of z will be in the range [(μ - σ), (μ + σ)]


• About 95 % of z will be in the range [(μ - 2σ), (μ + 2σ)]
Dr.V.Angayarkanni
• Rayleigh Noise

• The PDF of a Rayleigh noise is

for z > a

0 for z < a

• The mean & variance of this density is

&

• The Raleigh density is useful for approximating skewed


histograms
Dr.V.Angayarkanni
Dr.V.Angayarkanni
• Erlang (Gamma) Noise

• The PDF of a Erlang noise is

for z > 0

0 for z < 0

• The mean & variance of this density is

&

Dr.V.Angayarkanni
• Exponential Noise

• The PDF of a Exponential noise is

for z > 0

0 for z < 0

• The mean & variance of this density is

&

• The Exponential density is a special case of Erlang PDF


with b = 1
Dr.V.Angayarkanni
Gamma Exponential

Dr.V.Angayarkanni
• Uniform Noise

• The PDF of a Exponential noise is

If a < z <
b
0 for z < 0

• The mean & variance of this density is

&

Dr.V.Angayarkanni
• Impulse (Salt & pepper) Noise

• The PDF of (bipolar) Impulse noise is

for z = a

for z = b

0 otherwise

• If b > a, gray level b will appear as a light dot in the image

• If a > b, gray level a will appear as a dark dot in the image

Dr.V.Angayarkanni
Dr.V.Angayarkanni
• If either P or P is zero, the impulse noise is called
Unipolar
a b

• If they are not zero, but nearly equal, the impulse


noise will appear as “salt & pepper”

• It is also referred to as Shot & Spike noise

Dr.V.Angayarkanni
• The negative impulses appear as black points (pepper) and
positive impulses appear as white points (salt), in an image

• Gaussian noise arises due to electronic circuit noise & due


to sensor noise because of poor illumination and / or
temperature effect

Dr.V.Angayarkanni
• The Rayleigh density is helpful in characterizing noise
phenomena in range imaging

• The Exponential & Gamma densities find application in


Laser imaging

• Impulse noise arises due to quick transients such as faulty


switching

Dr.V.Angayarkanni
Periodic Noise

• Periodic noise arises from electrical or


electromagnetic interference

• The periodic noise can be reduced significantly


through frequency domain filtering

Dr.V.Angayarkanni
Estimation of Noise parameters

• Periodic noise tends to produce frequency


spikes, which can be easily detected by
visual analysis

• The histograms shown were calculated


using image data from these small strips Test pattern used

Dr.V.Angayarkanni
Gaussian Rayleigh Gamma
Images & Histograms resDur.lVt.iAnnggayfarrokamnnidifferent noise to the image
Exponential Uniform Salt & Pepper

Images & Histograms resulting from different noise to the image

Dr.V.Angayarkanni
Consider a strip or subimage denoted by S

• From basic statistics

&

• Where zi = gray level values of pixel in S

• P(zi) = corresponding normalized histogram values

Dr.V.Angayarkanni
• The shape of the histogram identifies the closest PDF match

• These two factors, mean & variance completely specify the PDF

• The heights of the peaks that corresponds to black and white pixels are the
estimates of Pa & Pb

Dr.V.Angayarkanni
Restoration with only noise
spatial parameters
• When the only gradation present in an image is noise, then

g(x,y) = f(x,y) + η(x,y)

G(u,v) = F(u,v) + N(u,v)

• In the case of periodic noise, we can estimate N(u,v) from the spectrum G(u,v)

• In that case N(u,v) can be subtracted from G(u,v), but it is not easily achieved

Dr.V.Angayarkanni
Mean Filters
Arithmetic Mean Filter

• Let S be the set of co-ordinates in a rectangular


xy

sub-image window of size m x n centered at (x,y)


• This filter computes the average value of the corrupted
image g(x,y) in the area defined by Sxy

• A mean filter smoothes local variations in an image


• Noise is reduced as a result of blurring

Dr.V.Angayarkanni
Geometric Mean Filter

• An image restored using Geometric Mean filter is given as

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


the sub image window raised to the power 1/mn
• Geometric mean filter is comparable with arithmetic
mean filter, but it loses image details

Dr.V.Angayarkanni
Harmonic Mean Filter

• The Harmonic Mean filtering is given by the expression

• The Harmonic mean filter works well for salt noise & Gaussian noise but
fails for the pepper noise

Dr.V.Angayarkanni
Contra Harmonic Mean Filter
• The Contra Harmonic Mean filtering is given by the
expression

Where Q is the order of the filter


• The Contra Harmonic Mean filter is very effective for salt &

pepper noise
• If Q is positive, it eliminates the pepper noise & If Q is negative, it
eliminates the salt noise, but not simultaneously

Dr.V.Angayarkanni
• The Contra Harmonic Mean filter reduces to the
arithmetic mean filter if Q = 0 & to the harmonic mean filter if
Q = -1

• In general the arithmetic mean & geometric mean filters


are suited for random noise like Gaussian or uniform noise
• The Contra Harmonic Mean filter is well suited for impulse
noise

• But it must be known whether the noise is light or dark, so


that appropriate polarity can be chosen for Q

Dr.V.Angayarkanni
Order-Statistics Filters

• The response is based on ordering or the ranking of the pixels contained in the

image area encompassed by the filter

• The response of the filter at any point is determined by the ranking result

Dr.V.Angayarkanni
Median Filter
• It replaces the value of a pixel by the median of the gray
levels in the neighborhood of the pixel

• It has excellent noise reduction capability with less


blurring
• Median filters are effective for bipolar & unipolar
impulse noise

Dr.V.Angayarkanni
Max Filters

• The 100th percentile of the median gives the Max value


• It replaces the value of a pixel by the maximum value of the
gray levels in the neighbourhood of the pixel

• This filter is useful in finding the brightest point in


an image

• The pepper noise has low gray values


• Hence this filter reduces the pepper noise

Dr.V.Angayarkanni
Min Filters

• The 0th percentile of the median gives the Min value


• It replaces the value of a pixel by the minimum value of the
gray levels in the neighbourhood of the pixel

• This filter is useful in finding the darkest point in


an image

• The salt noise has high gray values


• Hence this filter reduces the salt noise

Dr.V.Angayarkanni
Midpoint Filter
• This filter computes the midpoint between the maximum &
minimum values in the area encompassed by the filter

• This filter combines order statistics and averaging


• This filter is effective for randomly distributed noise like,

like Gaussian or uniform noise

Dr.V.Angayarkanni
Alpha trimmed mean
filter
• This filter deletes the d/2 lowest & the d/2 highest gray level values in
the neighborhood Sxy

• The average of the remaining (mn – d) pixels, forms this filter

• The value of d can vary from 0 to mn -1


• When d = 0, this filter becomes arithmetic mean filter

• When d = (mn-1)/2, it becomes the median filter

Dr.V.Angayarkanni
Adaptive Filters

• The behavior of these filters change based on statistical


characteristics of the image inside the filter region defined
by the m x n rectangular window Sxy

• These filters are superior in performance

Dr.V.Angayarkanni
Adaptive local noise reduction
filter
• The Mean & Variance are two simple statistical measures of a random variable

• These two are closely related to the appearance of an image


• The mean gives a measure of average gray level in the region over which the
mean is computed

• The variance gives a measure of average contrast in that region

Dr.V.Angayarkanni
• Let the selected local region be S
xy

• The response of the filter at any point (x,y) on which the region is

centered is based on:

A. g(x,y) the value of the noisy image at (x,y)

B. σ 2 the variance of the noise corrupting f(x,y) to form g(x,y)


η

C. mL the local mean of the pixels in Sxy

D. σ 2 the local variance of the pixels in S


L xy

Dr.V.Angayarkanni
• The expected behavior of the filter is
2
1. If ση is zero, the filter should return the value of g(x,y)

This is a trivial case in which g(x,y) = f(x,y)

2. If the local variance is high relative to σ 2, the filter should return a value close to g(x,y).
η

High local variance indicate the edges & they should be preserved

3. if the two variances are equal, it must return the mean value of the pixels in Sxy

Dr.V.Angayarkanni
• The adaptive expression for obtaining
based on the
above assumptions is

• The only quantity that is to be known or estimated is


2
the variance of the overall noise ση

• The other parameters are computed from the pixels in Sxy


at each location (x,y) on which the filter window is
centered
Dr.V.Angayarkanni
• As the noise is additive & position independent, we can
2 2
assume that ση < σL

2
• But very rarely only we get the value of ση

2 2 2 2
• Hence ση / σL is set to 1, whenever ση > σL

• This makes the filter non linear

• But it prevents absurd results i.e. negative gray levels


depending on the value mL
Dr.V.Angayarkanni
Periodic Noise Reduction
Ideal Band Reject Filters
• Band reject filters remove or attenuate a band of
frequencies about the origin of the Fourier Transform

• An ideal Band reject filter is given by the expression

0 if (D0 – W/2) < D(u,v) < (D0 + W/2)

• H(u,v) =

1 otherwise

• Where D(u,v) is the distance from the origin of the


centered frequency rectangle

Dr.V.Angayarkanni
• Butterworth Band Reject Filters

• Butterworth Band reject filters of order is given by

• Gaussian Band Reject Filters

• Gaussian Band reject filters of order n is given by

Dr.V.Angayarkanni
• Band Reject Filtering is used for noise removal in the
applications, where the approx location of the noise in the
frequency domain is known

• For example, for an image corrupted by additive periodic


noise, it can be approximated as 2D sinusoidal functions

• The Fourier transform of a sine has two mirror image


impulses

Dr.V.Angayarkanni
• Even small details & textures are restored effectively
• It will not be possible to get similar results by a direct
spatial domain approach using convolution masks

Dr.V.Angayarkanni
Dr.V.Angayarkanni
Band Pass Filters

• A Band Pass Filter performs the opposite operation of a


Band reject filter

• The transfer function of a band pass filter is given as


Hbp(u,v) = 1 - Hbr(u,v)

Dr.V.Angayarkanni
Notch filter

o Notch filter is the spatial form of band reject filter.


o Instead of removing the entire range of frequencies, it removes only selective components
o It is useful in removing a periodic signal of a clearly define frequency like the interference pattern caused by
electrical distribution.
o A notch filter rejects (or passes) frequencies in a predefined neighborhood of the frequency rectangle.

Purpose
Image restoration : Image having added with noise and degraded is to be restored with its original shape
Dr.V.Angayarkanni
Dr.V.Angayarkanni
Dr.V.Angayarkanni
Dr.V.Angayarkanni
Optimum notch filter

o The interference patterns have been simple to identify and characterize in the frequency domain, leading to the
specification of notch filter transfer functions that also are simple to define heuristically.
o When several interference components are present, heuristic specifications of filter transfer functions are not
always acceptable because they may remove too much image information in the filtering process (a highly
undesirable feature when images are unique and/or expensive to acquire).
o In addition, the interference components generally are not single-frequency bursts and It tend to have broad skirts
that carry information about the interference pattern. which are not always easily detectable from the normal
transform background.
o Alternative filtering methods that reduce the effect of these degradations are quite useful in practice.
o Hence the requirement of is optimum notch filter, in the sense that it minimizes local variances of the restored
estimate.
Dr.V.Angayarkanni
Dr.V.Angayarkanni
Dr.V.Angayarkanni
Dr.V.Angayarkanni
Dr.V.Angayarkanni
Degradation Model

f(x,y) h(x,y) Σ g(x,y)

n(x,y)

Degradation Model: g = h*f + n

Dr.V.Angayarkanni
Restoration Model

Degradation Restoration
f(x,y) f(x,y)
Model Filter

• Inverse Filter • Wiener Filter


• Pseudo-inverse Filter

Dr.V.Angayarkanni
f(x,y)
Approach
Build
g = h*f + n
degradation model

Analyze using g = Hf + n
algebraic techniques
W -1 g = DW -1 f + W -1 n

Formulate
restoration algorithms f = H -1 g

Implement using
Fourier transforms F(u,v) = G(u,v)/H(u,v)

f(x,y)
Dr.V.Angayarkanni
Estimating the degradation function

• There are three ways to estimate the degradation function, for use in image restoration

• Observation

• Experimentation

• Mathematical modeling

Dr.V.Angayarkanni
Inverse Filtering
• The simple method to restoration is direct inverse filtering

• The estimate F^(u,v) of the transform of the original image is obtained by


dividing the transform of the degraded image G(u,v), by the degradation
function

Dr.V.Angayarkanni
• since

• i.e. even if we know the degradation function, we cannot recover the un-degraded
image exactly as N(u,v) is a random function whose Fourier transform is not known

Dr.V.Angayarkanni
• At (u,v), H(u,v) ≈ 0

• Hence the second term becomes large

• Thus the noise N(u,v) is amplified

Dr.V.Angayarkanni
• One method to find the zero or small value problem is to limit the filter frequencies
to values near the origin

• H(0,0) is equal to the average value of h(x,y)

• It is usually the highest value of H(u,v) in the frequency domain

• Thus by limiting the analysis to frequencies near the origin, there is less possibility of
facing zero values

Dr.V.Angayarkanni
Inverse Filtering Examples

• The Inverse Filter works fine if there is no noise

• H(u,v) is usually low-pass function.

• N(u,v) is uniform over whole spectrum.


• But, High-frequency Noise also will get
amplified 0.4x

0.2x
Dr.V.Angayarkanni
Inverse Filtering

Dr.V.Angayarkanni
Wiener Filtering
• It is also called as Minimum Mean Square Error filtering

• Here images & noise are taken as random processes


• The aim is to find an estimate f^ of the uncorrupted image
f such that the mean square error between them is
minimum

• This error is given as

Where E{.} is the expected value of the argument

Dr.V.Angayarkanni
Wiener Estimator

x(t) h(t)
s(t) y(t)

n(t)

Mean Square Error =

Dr.V.Angayarkanni
• Given the degraded image g, the Wiener filter is an optimal filter h such
win
2
that E{|| f – hwing|| } is minimized.
• Assume that f and η are uncorrelated zero mean stationary 2D random
sequences with known power spectrum Sf and Sn. Thus,

Dr.V.Angayarkanni
Dr.V.Angayarkanni
Dr.V.Angayarkanni
• It is assumed that the noise & the image are uncorrelated
and that they have zero mean

• The gray levels in the estimate are linear function of the


levels in the degraded image

• Then the minimum error function in the frequency domain


is given as

Dr.V.Angayarkanni
• where

the degradation function

the complex conjugate of H(u,v)

the power spectrum of the noise


the power spectrum of the
Un-degraded image
Dr.V.Angayarkanni
• This result is known as Weiner Filter

• It is also referred to as or Least Square Error Filter


• The Weiner Filter does not have the same problem as the inverse filter with zeroes in the
degradation function, unless both H(u,v) & S(u,v) are zero for the same values of u & v

• The restored image in the spatial domain is given by the Inverse Fourier transform of the
frequency domain estimate F^(u,v)

Dr.V.Angayarkanni
Weiner Generalization

f(x,y) Degradation gx,y) Restoration f^(x,y)


s(t)
Function H Filter

η(x,y)

Degradation Restoration

Dr.V.Angayarkanni
Weiner FiltDer.Vr.AnCgahyarakarnnai
• If the noise is zero, then the noise power spectrum
vanishes & it becomes the Inverse Filter

• For spectral white noise, the noise power spectrum is


constant

• But, the power spectrum of the undegraded image is rarely


known

• In such cases an approximation is done as shown

Where K is a specified constant


Dr.V.Angayarkanni
Original f Degraded g

Inverse Filter Wiener Filter, K = 2

Dr.V.Angayarkanni
Dr.V.Angayarkanni
Wiener Filtering vs. Inverse Filtering

Full inverse filtering Limited inverse filtering Weiner filtering

Dr.V.Angayarkanni
Corrupted by Image Inverse Filtering WinerFiltering

Filtering - comparison

Noise variance magnitude less by 1

Noise variance magnitude less by 5

Dr.V.Angayarkanni

You might also like