image processing 8-imagerestoration.ppt

46
Course Website: http:// www.comp.dit.ie/bmacnamee Digital Image Processing Image Restoration: Noise Removal

Upload: mai-xuan-hoa

Post on 17-Jul-2016

14 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Image Processing 8-Imagerestoration.ppt

Course Website: http://www.comp.dit.ie/bmacnamee

Digital Image Processing

Image Restoration:Noise Removal

Page 2: Image Processing 8-Imagerestoration.ppt

2of31

Contents

In this lecture we will look at image restoration techniques used for noise removal

– What is image restoration?– Noise and images– Noise models– Noise removal using spatial domain filtering– Periodic noise– Noise removal using frequency domain filtering

Page 3: Image Processing 8-Imagerestoration.ppt

3of31

What is Image Restoration?

Image restoration attempts to restore images that have been degraded

– Identify the degradation process and attempt to reverse it

– Similar to image enhancement, but more objective

Page 4: Image Processing 8-Imagerestoration.ppt

4of31

Noise and Images

The sources of noise in digital images arise during image acquisition (digitization) and transmission

– Imaging sensors can be affected by ambient conditions

– Interference can be added to an image during transmission

Page 5: Image Processing 8-Imagerestoration.ppt

5of31

Noise Model

We can consider a noisy image to be modelled as follows:

where f(x, y) is the original image pixel, η(x, y) is the noise term and g(x, y) is the resulting noisy pixelIf we can estimate the model the noise in an image is based on this will help us to figure out how to restore the image

),( ),(),( yxyxfyxg

Page 6: Image Processing 8-Imagerestoration.ppt

6of31

Noise Corruption Example

Noisy Image x

yImage f (x, y)

54 52 57 55 56 52 51

50 49 51 50 52 53 58

51 51 52 52 56 57 60

48 50 51 49 53 59 63

49 51 52 55 58 64 67

148 154 157 160 163 167 170

151 155 159 162 165 169 172

Original Image x

yImage f (x, y)

Page 7: Image Processing 8-Imagerestoration.ppt

7of31

Noise Models

Gaussian Rayleigh

Erlang Exponential

Uniform

Impulse

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Pro

cess

ing

(200

2) There are many different models for the image noise term η(x, y):

– Gaussian• Most common model

– Rayleigh– Erlang– Exponential– Uniform– Impulse

• Salt and pepper noise

Page 8: Image Processing 8-Imagerestoration.ppt

8of31

Noise Example

The test pattern to the right is ideal for demonstrating the addition of noiseThe following slides will show the result of adding noise based on various models to this image

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Pro

cess

ing

(200

2)

Histogram to go here

Image

Histogram

Page 9: Image Processing 8-Imagerestoration.ppt

9of31

Noise Example (cont…)Im

ages

take

n fro

m G

onza

lez

& W

oods

, Dig

ital I

mag

e P

roce

ssin

g (2

002)

Gaussian Rayleigh Erlang

Page 10: Image Processing 8-Imagerestoration.ppt

10of31

Noise Example (cont…)Im

ages

take

n fro

m G

onza

lez

& W

oods

, Dig

ital I

mag

e P

roce

ssin

g (2

002)

Exponential Uniform Impulse

Histogram to go here

Page 11: Image Processing 8-Imagerestoration.ppt

11of31

Filtering to Remove Noise

We can use spatial filters of different kinds to remove different kinds of noiseThe arithmetic mean filter is a very simple one and is calculated as follows:

This is implemented as the simple smoothing filterBlurs the image to remove noise

xySts

tsgmn

yxf),(

),(1),(ˆ

1/91/9

1/9

1/91/9

1/9

1/91/9

1/9

Page 12: Image Processing 8-Imagerestoration.ppt

12of31

Noise Removal Example

54 52 57 55 56 52 51

50 49 51 50 52 53 58

51 204 52 52 0 57 60

48 50 51 49 53 59 63

49 51 52 55 58 64 67

148 154 157 160 163 167 170

151 155 159 162 165 169 172

Original Image x

yImage f (x, y)

Filtered Image x

yImage f (x, y)

Page 13: Image Processing 8-Imagerestoration.ppt

13of31

Other Means

There are different kinds of mean filters all of which exhibit slightly different behaviour:

– Geometric Mean– Harmonic Mean– Contraharmonic Mean

Page 14: Image Processing 8-Imagerestoration.ppt

14of31

Other Means (cont…)

There are other variants on the mean which can give different performanceGeometric Mean:

Achieves similar smoothing to the arithmetic mean, but tends to lose less image detail

mn

Sts xy

tsgyxf

1

),(

),(),(ˆ

Page 15: Image Processing 8-Imagerestoration.ppt

15of31

Noise Removal Example

54 52 57 55 56 52 51

50 49 51 50 52 53 58

51 204 52 52 0 57 60

48 50 51 49 53 59 63

49 51 52 55 58 64 67

148 154 157 160 163 167 170

151 155 159 162 165 169 172

Original Image x

yImage f (x, y)

Filtered Image x

yImage f (x, y)

Page 16: Image Processing 8-Imagerestoration.ppt

16of31

Other Means (cont…)

Harmonic Mean:

Works well for salt noise, but fails for pepper noiseAlso does well for other kinds of noise such as Gaussian noise

xySts tsg

mnyxf

),( ),(1),(ˆ

Page 17: Image Processing 8-Imagerestoration.ppt

17of31

Noise Corruption Example

54 52 57 55 56 52 51

50 49 51 50 52 53 58

51 204 52 52 0 57 60

48 50 51 49 53 59 63

49 51 52 55 58 64 67

50 54 57 60 63 67 70

51 55 59 62 65 69 72

Original Image x

yImage f (x, y)

Filtered Image x

yImage f (x, y)

Page 18: Image Processing 8-Imagerestoration.ppt

18of31

Other Means (cont…)

Contraharmonic Mean:

Q is the order of the filter and adjusting its value changes the filter’s behaviourPositive values of Q eliminate pepper noiseNegative values of Q eliminate salt noise

xy

xy

Sts

Q

Sts

Q

tsg

tsgyxf

),(

),(

1

),(

),(),(ˆ

Page 19: Image Processing 8-Imagerestoration.ppt

19of31

Noise Corruption Example

54 52 57 55 56 52 51

50 49 51 50 52 53 58

51 204 52 52 0 57 60

48 50 51 49 53 59 63

49 51 52 55 58 64 67

50 54 57 60 63 67 70

51 55 59 62 65 69 72

Original Image x

yImage f (x, y)

Filtered Image x

yImage f (x, y)

Page 20: Image Processing 8-Imagerestoration.ppt

20of31

Noise Removal ExamplesIm

ages

take

n fro

m G

onza

lez

& W

oods

, Dig

ital I

mag

e P

roce

ssin

g (2

002)

OriginalImage

ImageCorrupted By Gaussian Noise

After A 3*3Geometric Mean Filter

After A 3*3Arithmetic

Mean Filter

Page 21: Image Processing 8-Imagerestoration.ppt

21of31

Noise Removal Examples (cont…)

ImageCorruptedBy Pepper

Noise

Result of Filtering Above

With 3*3 Contraharmonic

Q=1.5

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Pro

cess

ing

(200

2)

Page 22: Image Processing 8-Imagerestoration.ppt

22of31

Noise Removal Examples (cont…)Im

ages

take

n fro

m G

onza

lez

& W

oods

, Dig

ital I

mag

e P

roce

ssin

g (2

002)

ImageCorruptedBy SaltNoise

Result of Filtering Above With 3*3 ContraharmonicQ=-1.5

Page 23: Image Processing 8-Imagerestoration.ppt

23of31

Contraharmonic Filter: Here Be Dragons

Choosing the wrong value for Q when using the contraharmonic filter can have drastic results

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Pro

cess

ing

(200

2)

Page 24: Image Processing 8-Imagerestoration.ppt

24of31

Order Statistics Filters

Spatial filters that are based on ordering the pixel values that make up the neighbourhood operated on by the filterUseful spatial filters include

– Median filter– Max and min filter– Midpoint filter– Alpha trimmed mean filter

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Pro

cess

ing

(200

2)

Page 25: Image Processing 8-Imagerestoration.ppt

25of31

Median Filter

Median Filter:

Excellent at noise removal, without the smoothing effects that can occur with other smoothing filtersParticularly good when salt and pepper noise is present

)},({),(ˆ),(

tsgmedianyxfxySts

Page 26: Image Processing 8-Imagerestoration.ppt

26of31

Noise Corruption Example

54 52 57 55 56 52 51

50 49 51 50 52 53 58

51 204 52 52 0 57 60

48 50 51 49 53 59 63

49 51 52 55 58 64 67

50 54 57 60 63 67 70

51 55 59 62 65 69 72

Original Image x

yImage f (x, y)

Filtered Image x

yImage f (x, y)

Page 27: Image Processing 8-Imagerestoration.ppt

27of31

Max and Min Filter

Max Filter:

Min Filter:

Max filter is good for pepper noise and min is good for salt noise

)},({max),(ˆ),(

tsgyxfxySts

)},({min),(ˆ),(

tsgyxfxySts

Page 28: Image Processing 8-Imagerestoration.ppt

28of31

Noise Corruption Example

54 52 57 55 56 52 51

50 49 51 50 52 53 58

51 204 52 52 0 57 60

48 50 51 49 53 59 63

49 51 52 55 58 64 67

50 54 57 60 63 67 70

51 55 59 62 65 69 72

Original Image x

yImage f (x, y)

Filtered Image x

yImage f (x, y)

Page 29: Image Processing 8-Imagerestoration.ppt

29of31

Midpoint Filter

Midpoint Filter:

Good for random Gaussian and uniform noise

)},({min)},({max

21),(ˆ

),(),(tsgtsgyxf

xyxy StsSts

Page 30: Image Processing 8-Imagerestoration.ppt

30of31

Noise Corruption Example

54 52 57 55 56 52 51

50 49 51 50 52 53 58

51 204 52 52 0 57 60

48 50 51 49 53 59 63

49 51 52 55 58 64 67

50 54 57 60 63 67 70

51 55 59 62 65 69 72

Original Image x

yImage f (x, y)

Filtered Image x

yImage f (x, y)

Page 31: Image Processing 8-Imagerestoration.ppt

31of31

Alpha-Trimmed Mean Filter

Alpha-Trimmed Mean Filter:

We can delete the d/2 lowest and d/2 highest grey levelsSo gr(s, t) represents the remaining mn – d pixels

xySts

r tsgdmn

yxf),(

),(1),(ˆ

Page 32: Image Processing 8-Imagerestoration.ppt

32of31

Noise Corruption Example

54 52 57 55 56 52 51

50 49 51 50 52 53 58

51 204 52 52 0 57 60

48 50 51 49 53 59 63

49 51 52 55 58 64 67

50 54 57 60 63 67 70

51 55 59 62 65 69 72

Original Image x

yImage f (x, y)

Filtered Image x

yImage f (x, y)

Page 33: Image Processing 8-Imagerestoration.ppt

33of31

Noise Removal ExamplesIm

ages

take

n fro

m G

onza

lez

& W

oods

, Dig

ital I

mag

e P

roce

ssin

g (2

002)

ImageCorrupted

By Salt AndPepper Noise

Result of 1 Pass With A 3*3 MedianFilter

Result of 2Passes With

A 3*3 MedianFilter

Result of 3 Passes WithA 3*3 MedianFilter

Page 34: Image Processing 8-Imagerestoration.ppt

34of31

Noise Removal Examples (cont…)Im

ages

take

n fro

m G

onza

lez

& W

oods

, Dig

ital I

mag

e P

roce

ssin

g (2

002)

ImageCorruptedBy Pepper

Noise

ImageCorruptedBy SaltNoise

Result Of Filtering Above With A 3*3 Min Filter

Result OfFiltering

AboveWith A 3*3Max Filter

Page 35: Image Processing 8-Imagerestoration.ppt

35of31

Noise Removal Examples (cont…)Im

ages

take

n fro

m G

onza

lez

& W

oods

, Dig

ital I

mag

e P

roce

ssin

g (2

002) Image

CorruptedBy Uniform

Noise

Image FurtherCorruptedBy Salt andPepper Noise

Filtered By5*5 Arithmetic

Mean Filter

Filtered By5*5 Median

Filter

Filtered By5*5 GeometricMean Filter

Filtered By5*5 Alpha-TrimmedMean Filter

Page 36: Image Processing 8-Imagerestoration.ppt

36of31

Periodic Noise

Typically arises due to electrical or electromagnetic

interferenceGives rise to regular noise patterns in an imageFrequency domain techniques in the Fourier domain are most effective at removing periodic noise

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Pro

cess

ing

(200

2)

Page 37: Image Processing 8-Imagerestoration.ppt

37of31

Band Reject Filters

Removing periodic noise form an image involves removing a particular range of frequencies from that imageBand reject filters can be used for this purposeAn ideal band reject filter is given as follows:

2),( 1

2),(

2 0

2),( 1

),(

0

00

0

WDvuDif

WDvuDWDif

WDvuDif

vuH

Page 38: Image Processing 8-Imagerestoration.ppt

38of31

Band Reject Filters (cont…)

The ideal band reject filter is shown below, along with Butterworth and Gaussian versions of the filter

Imag

es ta

ken

from

Gon

zale

z &

Woo

ds, D

igita

l Im

age

Pro

cess

ing

(200

2)

Ideal BandReject Filter

ButterworthBand Reject

Filter (of order 1)

GaussianBand Reject

Filter

Page 39: Image Processing 8-Imagerestoration.ppt

39of31

Band Reject Filter ExampleIm

ages

take

n fro

m G

onza

lez

& W

oods

, Dig

ital I

mag

e P

roce

ssin

g (2

002) Image corrupted by

sinusoidal noiseFourier spectrum of

corrupted image

Butterworth band reject filter

Filtered image

Page 40: Image Processing 8-Imagerestoration.ppt

40of31

Summary

In this lecture we will look at image restoration for noise removalRestoration is slightly more objective than enhancement Spatial domain techniques are particularly useful for removing random noiseFrequency domain techniques are particularly useful for removing periodic noise

Page 41: Image Processing 8-Imagerestoration.ppt

41of31

Adaptive Filters

The filters discussed so far are applied to an entire image without any regard for how image characteristics vary from one point to anotherThe behaviour of adaptive filters changes depending on the characteristics of the image inside the filter regionWe will take a look at the adaptive median filter

Page 42: Image Processing 8-Imagerestoration.ppt

42of31

Adaptive Median Filtering

The median filter performs relatively well on impulse noise as long as the spatial density of the impulse noise is not largeThe adaptive median filter can handle much more spatially dense impulse noise, and also performs some smoothing for non-impulse noiseThe key insight in the adaptive median filter is that the filter size changes depending on the characteristics of the image

Page 43: Image Processing 8-Imagerestoration.ppt

43of31

Adaptive Median Filtering (cont…)

Remember that filtering looks at each original pixel image in turn and generates a new filtered pixelFirst examine the following notation:

– zmin = minimum grey level in Sxy

– zmax = maximum grey level in Sxy

– zmed = median of grey levels in Sxy

– zxy = grey level at coordinates (x, y)

– Smax =maximum allowed size of Sxy

Page 44: Image Processing 8-Imagerestoration.ppt

44of31

Adaptive Median Filtering (cont…)

Level A: A1 = zmed – zmin

A2 = zmed – zmax

If A1 > 0 and A2 < 0, Go to level BElse increase the window sizeIf window size ≤ repeat Smax level AElse output zmed

Level B: B1 = zxy – zmin

B2 = zxy – zmax

If B1 > 0 and B2 < 0, output zxy

Else output zmed

Page 45: Image Processing 8-Imagerestoration.ppt

45of31

Adaptive Median Filtering (cont…)

The key to understanding the algorithm is to remember that the adaptive median filter has three purposes:

– Remove impulse noise– Provide smoothing of other noise– Reduce distortion

Page 46: Image Processing 8-Imagerestoration.ppt

46of31

Adaptive Filtering ExampleIm

ages

take

n fro

m G

onza

lez

& W

oods

, Dig

ital I

mag

e P

roce

ssin

g (2

002)

Image corrupted by salt and pepper noise with

probabilities Pa = Pb=0.25

Result of filtering with a 7 * 7 median filter

Result of adaptive median filtering with i = 7