Image restoration - Washington State University

19
Image restoration Adaptive local noise reduction filter Filter operation is not uniform at all pixel locations but depends on the local characteristics (local mean, local variance) of the observed image. Consider an observed image g(m,n) and an b a × window ab S . Let 2 η σ be the noise variance and ) , ( n m m L , ) , ( 2 n m L σ be the local mean and variance of g(m,n) over an b a × window around (m,n). The adaptive filter is given by: ( 29 ) , ( ) , ( ) , ( ) , ( ) , ( ˆ 2 2 n m m n m g n m n m g n m f L L - σ σ - = η Usually, we need to be careful about the possibility of 2 2 ) , ( η σ < σ n m L , in which case, we could potentially get a negative output gray value. This filter does the following: o If 0 2 = σ η (or is small), the filter simply returns the value of g(m,n). o If the local variance ) , ( 2 n m L σ is high relative to the noise variance 2 η σ , the filter returns a value close to g(m,n). This usually corresponds to a location associated with edges in the image. o If the two variances are roughly equal, the filter does a simple averaging over window ab S .

Transcript of Image restoration - Washington State University

Page 1: Image restoration - Washington State University

Image restoration

Adaptive local noise reduction filter

• Filter operation is not uniform at all pixel locations but depends on

the local characteristics (local mean, local variance) of the observed image.

• Consider an observed image g(m,n) and an ba × window abS . Let 2ησ

be the noise variance and ),( nmmL , ),(2 nmLσ be the local mean and variance of g(m,n) over an ba × window around (m,n).

• The adaptive filter is given by:

( )),(),(),(

),(),(ˆ2

2

nmmnmgnm

nmgnmf LL

−σ

σ−= η

• Usually, we need to be careful about the possibility of 22 ),( ησ<σ nmL , in which case, we could potentially get a negative output gray value.

• This filter does the following:

o If 02 =ση (or is small), the filter simply returns the value of g(m,n).

o If the local variance ),(2 nmLσ is high relative to the noise

variance 2ησ , the filter returns a value close to g(m,n). This

usually corresponds to a location associated with edges in the image.

o If the two variances are roughly equal, the filter does a simple averaging over window abS .

Page 2: Image restoration - Washington State University

Example

Adaptive median filter ing • Read from text (page 241-243).

Page 3: Image restoration - Washington State University

Per iodic Inter ference/Noise

• Periodic noise or interference occurs in images due to electrical or electromechanical interference during image acquisition.

• It is an example of spatially dependent noise. • This type of noise can be very effectively removed using frequency

domain filtering. Recall that the spectrum of a pure sinusoid would be a simple impulse at the appropriate frequency location.

Page 4: Image restoration - Washington State University

Bandreject filters • Bandreject filters remove (or attenuate) a band of frequencies, around

some frequency, say 0D . • An ideal bandreject filter is given by:

�����

+>+≤≤−

−<=

20

2020

20

),(1

),( if0

),( if1

),(W

WW

W

DvuD

DvuDD

DvuD

vuH

where 22),( vuvuD += .

• W is usually referred to the width of the (stop) band and 0D as the center frequency.

• A Butterworth bandreject filter of order n is given by

n

DvuD

WvuDvuH 2

20

2 ),(

),(1

1),( �

����

−+

= .

• A Gaussian bandreject filter is given by

220

2

21

),(

),(

1),( �� �� −−

−= WvuD

DvuD

evuH

Page 5: Image restoration - Washington State University

Example

• Bandreject filters are ideally suited for filtering out periodic interference.

• Recall that the Fourier transform of a pure sine or cosine function is just a pair of impulses.

• Therefore the interference is “ localized” in the spectral domain and one can easily identify this region and filter it out.

Page 6: Image restoration - Washington State University

Bandpass filters • Bandpass filters are the exact opposite of bandreject filters. They pass

a band of frequencies, around some frequency, say 0D (rejecting the rest).

• One can write: ),(1),( vuHvuH brbp −=

• Bandpass filter is usually used to isolate components of an image that correspond to a band of frequencies.

• It can also be used to isolate noise interference, so that more detailed analysis of the interference can be performed, independent of the image.

Page 7: Image restoration - Washington State University

Notch filter

• It is a kind of bandreject/bandpass filter that rejects/passes a very narrow set of frequencies, around a center frequency.

• Due to symmetry considerations, the notches must occur in symmetric pairs about the origin of the frequency plane.

• The transfer function of an ideal notch-reject filter of radius 0D with center frequency ( )00,vu is given by

���� ≤≤=

otherwise1

),(or ),( if0),( 0201 DvuDDvuD

vuH

where

( ) ( )[ ] 5.020

201 2/2/),( vNvuMuvuD −−+−−=

and

( ) ( )[ ] 5.020

202 2/2/),( vNvuMuvuD +−++−=

• The transfer function of a Butterworth notch reject filter of order n is

given by

n

vuDvuD

DvuH �

����+

=

),(),(1

1),(

21

20

.

• A Gaussian notch reject filter is given by

2

20

2121 ),(),(

1),( �� ��−

−= D

vuDvuD

evuH

• A notch pass filter can be obtained from a notch reject filter using: ),(1),( vuHvuH nrnp −=

Page 8: Image restoration - Washington State University

I llustration of transfer function of notch filters

Page 9: Image restoration - Washington State University

Example

• Image corrupted by periodic horizontal scan lines.

Page 10: Image restoration - Washington State University

Optimum Notch Filter ing

• When interference patterns are more complicated, the preceding filters tend to reject more image information in an attempt to filter out the noise.

• In this case, we first filter out the noise interference using a notch

pass filter:

{ }),(),(

),(),(),(1 vuNnm

vuGvuHvuN−=η

=

F

• The image ),( nmη yields a rough estimate of the interference pattern. • We can then subtract off a weighted portion of ),( nmη from the

image g(m,n) to obtain our restored image: ),(),(),(),(ˆ nmnmwnmgnmf η−=

• It is possible to design the weighting function or modulation function

),( nmw in an optimal fashion. See section 5.4.4 (page 251,252) of text for details.

Page 11: Image restoration - Washington State University

Linear , position-invar iant degradation

• We will now consider the general degradation equation (see page 254, 255 of text for a derivation of this equation):

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

),(),(*),(),(

vuNvuFvuHvuG

nmnmfnmhnmg

+=η+=

• This consists of a “blurring” function h(m,n), in addition the random

noise component ),( nmη . • The blurring function h(m,n) is usually referred to as a point-spread

function (PSF) and represents the observed image corresponding to imaging an impulse or point source of light.

• In this case, we need to have a good knowledge of the PSF h(m,n), in

addition to knowledge of the noise statistics. This can be done in practice using one of the following methods:

Using Image observation

o Identify portions of the observed image (subimage) that are relatively noise-free and which corresponds to some simple structures.

o We can then obtain ),(ˆ),(

),(vuF

vuGvuH

s

ss = , where ),( vuGs is the

spectrum of the observed subimage, ),(ˆ vuFs is our estimate of the spectrum of the original image (based on the simple structure that the subimage represents).

o Based on the characteristic of the function ),( vuH s , once can rescale to obtain the overall PSF ),( vuH .

Page 12: Image restoration - Washington State University

Exper imentation

• If feasible, image a known object, usually a point source of light, using the given imaging equipment and setup.

• If A is the intensity of light source and G(u,v) is the observed spectrum, we have

A

vuGvuH

),(),( = .

Modeling

• A physical model is often used to obtain the PSF. • Blurring due to atmospheric turbulence can be modeled by the

transfer function:

6/522 )(),( vukevuH +−= where k is a constant that depends on the nature of the turbulence. • Note that this is similar to a Gaussian lowpass filter.

Page 13: Image restoration - Washington State University

• Gaussian lowpass filter is also often used to model mild uniform blurring.

• Precise mathematical modeling of the blurring process is sometime

used. For example, blurring due to uniform motion is modeled as:

[ ] )()(sin)(

),( vbuajevbuavbua

TvuH +π−+π

+π=

Page 14: Image restoration - Washington State University

where T is the duration of exposure and a and b are the displacements in the x- and y-directions, respectively, during this time T.

Page 15: Image restoration - Washington State University

Inverse Filter

• The simplest approach to restoration is direct inverse filtering. This is obtained as follows:

,1,,1,0, ),,(),(),(ˆ

),(),(

),(ˆ

−==�=

NvuvuGvuRvuF

vuH

vuGvuF

��

where��

),(

1),(

vuHvuR = .�

• We�can�rewrite�this�in�the�spatial�domain�as�follows:�

� ��

����==),(),(

IDFT),(*),(),(ˆvuH

vuGnmrnmgnmf .��

• In�practice,�we�actually�use�a�slightly�modified�filter:�

��

ε>=otherwise���,0

),(���,),(

1),(

vuHvuHvuR �

where� ε� is� a� small� value.� This� avoids� numerical� problems� when�),( vuH �is�small.��

• The� inverse� filter� works� fine� provided� there� is� no� noise.� This� is�illustrated�in�the�following�example.��

• Let� us� now� analyze� the� performance� of� the� inverse� filter� in� the�presence�of�noise.�Indeed,�in�this�case:��

),(),(),(),( vuNvuFvuHvuG += ,�

Page 16: Image restoration - Washington State University

which�gives��

),(

),(),(

),(

),(),(ˆ

vuH

vuNvuF

vuH

vuGvuF +== �

• Hence�noise�actually�gets�amplified�at�frequencies�where� ),( vuH �is�zero� or� very� small.� In� fact,� the� contribution� from� the� noise� term�dominates�at�these�frequencies.��

• As�illustrated�by�an�example,� the� inverse�filter�fails�miserably� in�the�presence� of� noise.� It� is� therefore,� seldom� used� in� practice,� in� the�presence�of�noise.��

Page 17: Image restoration - Washington State University

Inverse�Filtering�example�(no�noise)����

���

�����

�����

�������

����

��

001.0

111

111

111

12

=

����

����

=

×

εNN

Nh

�����

),( nmf

),( nmg

),(ˆ nmf

7=N

014.0MSE =

51063MSE -. ×=

03.0MSE =

4103.2MSE -×=

11=N

0029.0MSE =

05.0MSE =

15=N

Page 18: Image restoration - Washington State University

Inverse�Filtering�example�(no�noise)����

���

���

�����

��

����

���

001.0

1

1),(

2

0

22

=

����

���� ++

=

ε

r

vuvuH

),( nmf

),( nmg ),(ˆ nmf

110 =r

02.0MSE = 008.0MSE =

150 =r

017.0MSE = 005.0MSE =

230 =r

013.0MSE = 0016.0MSE =

Page 19: Image restoration - Washington State University

Inverse�Filtering�example�(with�noise)����

���

�����

�����

������

����

���

01.0

111

111

111

25

1

55

=

����

����

=

×

ε

�����

h),( nmf

),(ˆ nmf

9.0MSE =

007.0MSE =

09.0MSE =

01.0=σ

0075.0MSE =

02.0=σ

008.0MSE =

03.0=σ

),( nmg

47.0MSE =

Zero-mean�Gaussian�noise�with�variance� 2σ �