40
Digital Image Processing Lecture 4 Image Restoration and Reconstruction Second Semester Azad University Islamshar Branch Y.ebrahimdoost@iiau. ac.ir

Digital Image Processing Lecture 4 Image Restoration and Reconstruction Second Semester Azad University Islamshar Branch [email protected]

Embed Size (px)

Citation preview

Digital Image Processing

Lecture 4

Image Restoration and Reconstruction

Second Semester

Azad University

Islamshar Branch

[email protected]

Image Restoration• The main aim of restoration is to improve an image in

some predefined way.

• Image restoration tries to reconstruct or recover an image which was degraded using a priori knowledge of degradation.

• Here we model the degradation and apply the inverse process to recover the original image.

• Enhancement techniques take advantage of the psychophysical

aspects of human visual system. for example contrast stretching is an enhancement method as it is concerned with the pleasing aspects of a viewer, whereas removl of image blur is a restoration process.

In this model, we assume that there is an additive noise term, operating on an input image f(x,y) to produce a degraded image g(x,y).

Given g(x,y) and some information about degradation function H, and knowledge about noise term η(x,y).

The aim of restoration is to get an estimate f(x,y) of original image.

The more we know about H and term η, we get better results.

Model of Image Degradation / Restoration Process

Model of Image Degradation / Restoration Process

If is a process, then

the degraded image is given in the spatial domain by

( , ) ( , ) ( , ) ( , )

H linear, position-invariant

g x y h x y f x y x y

The model of the degraded image is given in

the frequency domain by

( , ) ( , ) ( , ) ( , )G u v H u v F u v N u v

Noise Sources

The principal sources of noise in digital images arise during image acquisition and/or transmission.

• Image acquisition e.g., light levels, sensor temperature, etc.

• Transmission e.g., lightning or other atmospheric disturbance in wireless network

Noise Models

White noiseThe Fourier spectrum of noise is constant

Gaussian noise

Electronic circuit noise, sensor noise due to poor illumination and/or high temperature

Rayleigh noise

Range imaging

periodic noise With the exception of spatially periodic noise, we assume:

Noise is independent of spatial coordinatesNoise is uncorrelated with respect to the image itself

Erlang (gamma) noise:

Laser imaging

Exponential noise:

Laser imaging

Uniform noise: Least descriptive; Basis for numerous random number generators

Impulse noise:

quick transients, such as faulty switching

Noise Models

2 2( ) /2

The PDF of Gaussian random variable, z, is given by

1 ( )

2z zp z e

where, represents intensity

is the mean (average) value of z

is the standard deviation

z

z

Noise Models

Gaussian Noise

70% of its values will be in the range

95% of its values will be in the range

)(),(

)2(),2(

2

The mean and variance of this density are given by

/ 4

(4 )

4

z a b

b

2( ) /

The PDF of Rayleigh noise is given by

2( ) for

( )0 for

z a bz a e z ap z b

z a

Noise Models

Rayleigh Noise

1

The PDF of Erlang noise is given by

for 0 ( ) ( 1)!

0 for

b baza z

e zp z b

z a

2 2

The mean and variance of this density are given by

/

/

z b a

b a

Noise Models

Erlang (Gamma) Noise

The PDF of exponential noise is given by

for 0 ( )

0 for

azae zp z

z a

2 2

The mean and variance of this density are given by

1/

1/

z a

a

Exponential Noise

Noise Models

The PDF of uniform noise is given by

1 for a

( )0 otherwise

z bp z b a

2 2

The mean and variance of this density are given by

( ) / 2

( ) /12

z a b

b a

Uniform Noise

Noise Models

The PDF of (bipolar) impulse noise is given by

for

( ) for

0 otherwise

a

b

P z a

p z P z b

if , gray-level will appear as a light dot,

while level will appear like a dark dot.

b a b

a

If either or is zero, the impulse noise is calleda bP P

unipolar

Impulse (Salt-and-Pepper) Noise

Noise Models

PDF of noises

Examples of Noise: Original Image

Examples of Noise: Noisy Images(1)

Examples of Noise: Noisy Images(2)

Periodic Noise • Periodic noise in an image arises typically from

electrical or electromechanical interference during image acquisition.

• Periodic noise can be reduced significantly via frequency domain filtering

Estimation of Noise Parameters

The shape of the histogram identifies the closest PDF match

Consider a subimage denoted by , and let ( ), 0, 1, ..., -1,

denote the probability estimates of the intensities of the pixels in .

The mean and variance of the pixels in :

s iS p z i L

S

S

1

0

12 2

0

( )

and ( ) ( )

L

i s ii

L

i s ii

z z p z

z z p z

Estimation of Noise Parameters

Noise model without degradation

( , ) ( , ) ( , )

and

( , ) ( , ) ( , )

g x y f x y x y

G u v F u v N u v

Restoration in the Presence of Noise Only̶ Spatial Filtering

Spatial Filtering: Mean Filters

Let represent the set of coordinates in a rectangle

subimage window of size , centered at ( , ).

xyS

m n x y

( , )

Arithmetic mean filter

1 ( , ) ( , )

xys t S

f x y g s tmn

1

( , )

Geometric mean filter

( , ) ( , )xy

mn

s t S

f x y g s t

Generally, a geometric mean filter achieves smoothing comparable to the arithmetic mean filter, but it tends to lose less image detail in the process

( , )

Harmonic mean filter

( , )1

( , )xys t S

mnf x y

g s t

Spatial Filtering: Mean Filters

It works well for salt noise, but fails for pepper noise.It does well also with other types of noise like Gaussian noise.

1

( , )

( , )

Contraharmonic mean filter

( , )

( , )( , )

xy

xy

Q

s t S

Q

s t S

g s t

f x yg s t

Q is the order of the filter.

It is well suited for reducing the effects of salt-and-pepper noise. Q>0 for pepper noise and Q<0 for salt noise.

• Arithmetic and geometric mean filters are good for removing random noise like Gaussian or uniform noise.

• Contraharmonic filer is good for impulse noise.

• But it must be known before hand that whether the noise is dark or light to fix the Q value.

Contraharmonic filer vs Arithmetic and geometric mean filters

Spatial Filtering: Example (1)

Spatial Filtering: Example (2)

Spatial Filtering: Example (3)

( , )

Median filter

( , ) ( , )xys t S

f x y median g s t

( , )

Max filter

( , ) max ( , )xys t S

f x y g s t

( , )

Min filter

( , ) min ( , )xys t S

f x y g s t

Spatial Filtering: Order-Statistic Filters

( , )( , )

Midpoint filter

1 ( , ) max ( , ) min ( , )

2 xyxy s t Ss t Sf x y g s t g s t

( , )

Alpha-trimmed mean filter

1 ( , ) ( , )

xy

rs t S

f x y g s tmn d

Spatial Filtering: Order-Statistic Filters

We delete the / 2 lowest and the / 2 highest intensity values of

( , ) in the neighborhood . Let ( , ) represent the remaining

- pixels.

xy r

d d

g s t S g s t

mn d

A filter formed by averaging these remaining pixels is called an alpha-trimmed mean filter

Spatial Filtering: Order-Statistic Filters (Example)

Spatial Filtering: Order-Statistic Filters (Example)

Spatial Filtering: Order-Statistic Filters (Example)

Spatial Filtering: Adaptive Filters

2

: local region

The response of the filter at the center point (x,y) of

is based on four quantities:

(a) ( , ), the value of the noisy image at ( , );

(b) , the variance of the noise corrupti

xy

xy

S

S

g x y x y

2

ng ( , )

to form ( , );

(c) , the local mean of the pixels in ;

(d) , the local variance of the pixels in .

L xy

L xy

f x y

g x y

m S

S

Adaptive, Local Noise Reduction Filters

2

2

The behavior of the filter:

(a) if is zero, the filter should return simply the value

of ( , ).

(b) if the local variance is high relative to , the filter

should return a value cl

g x y

ose to ( , );

(c) if the two variances are equal, the filter returns the

arithmetic mean value of the pixels in .xy

g x y

S

Spatial Filtering: Adaptive Filters

Adaptive, Local Noise Reduction Filters

2

2

An adaptive expression for obtaining ( , )

based on the assumptions:

( , ) ( , ) ( , ) LL

f x y

f x y g x y g x y m

Adaptive, Local Noise Reduction Filters(Example)

Spatial Filtering: Adaptive Filters

Adaptive Median Filters

min

max

med

max

The notation:

minimum intensity value in

maximum intensity value in

median intensity value in

intensity value at coordinates ( , )

maximum all

xy

xy

xy

xy

z S

z S

z S

z x y

S

owed size of xyS

Spatial Filtering: Adaptive Filters

Adaptive Median Filters

med min med max

max

The adaptive median-filtering works in two stages:

Stage A:

A1 = ; A2 =

if A1>0 and A2<0, go to stage B

Else increase the window size

if window size , re

z z z z

S

med

min max

med

peat stage A; Else output

Stage B:

B1 = ; B2 =

if B1>0 and B2<0, output ; Else output

xy xy

xy

z

z z z z

z z

Example: Adaptive Median Filters

Periodic Noise Reduction by Frequency Domain Filtering

Periodic noise may occur if the imaging equipment (the acquisition or networking hardware) is subject to electronic disturbance of a repeating nature, such as be caused by electric motor.1. Band reject filtering

A filter consists of ones with a ring of zeros.

Homework 6

2. Read a gray scale image and add Gaussian noise with 0 mean then apply the Adaptive Mean Filter to reduction noise.

1. Produce a sub image of a colour image and add 5% salt & pepper

noise and try to clean noise by following filters:1. Arithmetic mean filter2. Harmonic mean filter3. Contrahormonic mean filter4. Median filter5. Max filter6. Min filter7. Mid point filter

Which methods gives the best results ?

3. Load an image and make periodic noise and finally clear the Noise with Fast Foureir Transform.

4. Search which of the defined filters have best results on different noisy

image