43
Image Restoration 1 Image restoration vs. image enhancement Enhancement: largely a subjective process Priori knowledge about the degradation is not a must (sometimes no degradation is involved) Procedures are heuristic and take advantage of the psychophysical aspects of human visual system Restoration: more an objective process Images are degraded Tries to recover the images by using the knowledge about the degradation

Image Restoration

  • Upload
    yuki

  • View
    46

  • Download
    0

Embed Size (px)

DESCRIPTION

Image Restoration. Image restoration vs. image enhancement Enhancement : largely a subjective process Priori knowledge about the degradation is not a must (sometimes no degradation is involved) Procedures are heuristic and take advantage of the psychophysical aspects of human visual system - PowerPoint PPT Presentation

Citation preview

Page 1: Image Restoration

Image Restoration

1

• Image restoration vs. image enhancement

Enhancement:largely a subjective processPriori knowledge about the degradation is not a must (sometimes no degradation is involved)Procedures are heuristic and take advantage of the psychophysical aspects of human visual system

Restoration:more an objective processImages are degradedTries to recover the images by using the knowledge about the degradation

Page 2: Image Restoration

2

Limitation of Imaging Technology Two plagues in image acquisition

Noise interference Blur (motion, out-of-focus, hazy

weather) Difficult to obtain high-quality

images as imaging goes Beyond visible spectrum Micro-scale (microscopic imaging) Macro-scale (astronomical imaging)

Page 3: Image Restoration

What is Noise? Wiki definition: noise means any

unwanted signal One person’s signal is another

one’s noise Noise is not always random and

randomness is an artificial term Noise is not always bad (see

stochastic resonance example in the next slide) 3

Page 4: Image Restoration

Stochastic Resonance

4

no noise heavy noiselight noise

Page 5: Image Restoration

5

Image Denoising Where does noise come from?

Sensor (e.g., thermal or electrical interference)

Environmental conditions (rain, snow etc.)

Why do we want to denoise? Visually unpleasant Bad for compression Bad for analysis

Page 6: Image Restoration

EE465: Introduction to Digital Image Processing 6

electrical interference

Noisy Image Examples

thermal imaging

ultrasound imagingphysical interference

Page 7: Image Restoration

EE465: Introduction to Digital Image Processing 7

(Ad-hoc) Noise Modeling Simplified assumptions

Noise is independent of signal Noise types

Independent of spatial location Impulse noise Additive white Gaussian noise

Spatially dependent Periodic noise

Page 8: Image Restoration

8

Image Denoising Introduction Impulse noise removal

Median filtering Additive white Gaussian noise

removal 2D convolution and DFT

Periodic noise removal Band-rejection and Notch filter

Page 9: Image Restoration

9

Impulse Noise (salt-pepper Noise)

Definition

Each pixel in an image has the probability of p/2 (0<p<1) being contaminated by either a white dot (salt) or a black dot (pepper)

WjHi

jiXjiY

1,1

),(0

255),(

with probability of p/2with probability of p/2with probability of 1-p

noisy pixels

clean pixels

X: noise-free image, Y: noisy image

Note: in some applications, noisy pixels are not simply black or white, which makes the impulse noise removal problem more difficult

Page 10: Image Restoration

10

Numerical ExampleP=0.1

128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128

X

128 128 255 0 128 128 128 128 128 128 128 128 128 128 0 128 128 128 128 0 128 128 128 128 128 128 128 128 128 128 128 128 0 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 0 128 128 128 128 255 128 128 128 128 128 128 128 128 128 128 128 128 128 255 128 128 128 128 128 128 128 255 128 128

Y

Noise level p=0.1 means that approximately 10% of pixels are contaminated bysalt or pepper noise (highlighted by red color)

Page 11: Image Restoration

EE465: Introduction to Digital Image Processing 11

MATLAB Command>Y = IMNOISE(X,'salt & pepper',p)

Notes:

The intensity of input images is assumed to be normalized to [0,1].If X is double, you need to do normalization first, i.e., X=X/255;If X is uint8, MATLAB would do the normalization automatically The default value of p is 0.05 (i.e., 5 percent of pixels are contaminated) imnoise function can produce other types of noise as well (you need to change the noise type ‘salt & pepper’)

Page 12: Image Restoration

12

Impulse Noise Removal Problem

Noisy image Y

filteringalgorithm

Can we make the denoised image X as closeto the noise-free image X as possible?

^

X̂denoisedimage

Page 13: Image Restoration

EE465: Introduction to Digital Image Processing 13

Median Operator Given a sequence of numbers {y1,

…,yN} Mean: average of N numbers Min: minimum of N numbers Max: maximum of N numbers Median: half-way of N numbersExample ]56,55,54,255,52,0,50[y

54)( ymedian

]255,56,55,54,52,50,0[y

sorted

Page 14: Image Restoration

14

y(n)

W=2T+1

)](),...,(),...,([)(ˆ TnynyTnymediannx

1D Median Filtering

… …

Note: median operator is nonlinear

MATLAB command: x=median(y(n-T:n+T));

Page 15: Image Restoration

15

x(m,n)

W: (2T+1)-by-(2T+1) window

2D Median Filtering

)],(),...,,(),...,,(),...,,(),...,,([),(ˆ

TnTmyTnTmynmyTnTmyTnTmymediannmx

Page 16: Image Restoration

16

Numerical Example 225 225 225 226 226 226 226 226 225 225 255 226 226 226 225 226 226 226 225 226 0 226 226 255 255 226 225 0 226 226 226 226 225 255 0 225 226 226 226 255 255 225 224 226 226 0 225 226 226 225 225 226 255 226 226 228 226 226 225 226 226 226 226 226

0 225 225 226 226 226 226 226 225 225 226 226 226 226 226 226 225 226 226 226 226 226 226 226 226 226 225 225 226 226 226 226 225 225 225 225 226 226 226 226 225 225 225 226 226 226 226 226 225 225 225 226 226 226 226 226 226 226 226 226 226 226 226 226

Y X̂

Sorted: [0, 0, 0, 225, 225, 225, 226, 226, 226]

Page 17: Image Restoration

17

Image ExampleP=0.1

Noisy image Y X̂denoisedimage

3-by-3 window

Page 18: Image Restoration

18

Image Example (Con’t)

3-by-3 window 5-by-5 window

clean noisy(p=0.2)

Page 19: Image Restoration

EE465: Introduction to Digital Image Processing 19

Reflections What is good about median

operation? Since we know impulse noise appears

as black (minimum) or white (maximum) dots, taking median effectively suppresses the noise

What is bad about median operation? It affects clean pixels as well Noticeable edge blurring after median

filtering

Page 20: Image Restoration

EE465: Introduction to Digital Image Processing 20

Idea of Improving Median Filtering Can we get rid of impulse noise

without affecting clean pixels? Yes, if we know where the clean pixels

areor equivalently where the noisy pixels

are How to detect noisy pixels?

They are black or white dots

Page 21: Image Restoration

21

Median Filtering with Noise Detection

Noisy image Y

x=medfilt2(y,[2*T+1,2*T+1]);Median filtering

Noise detectionC=(y==0)|(y==255);

xx=c.*x+(1-c).*y;Obtain filtering results

Page 22: Image Restoration

EE465: Introduction to Digital Image Processing 22

Image Example

clean noisy(p=0.2)

w/onoisedetection

withnoisedetection

Page 23: Image Restoration

Mean Filter size =7 x 7

Median Filter size =7 x 7

Page 24: Image Restoration

The maximum filter selects the largest value within of pixel values, whereas the minimum filter selects the smallest value.

Minimum filtering ( mask size =3 x 3)

Minimum filtering causes the darker regions of an image to swell in size and dominate the lighter regions ( mask size =7 x 7)

Page 25: Image Restoration

Result from Maximum filtering with mask (3 x 3)

Result from Maximum filtering with mask (7 x 7)

Page 26: Image Restoration

Alpha-Trimmed Mean FilterAlpha-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 27: Image Restoration

27

Image Denoising Introduction Impulse noise removal

Median filtering Additive white Gaussian noise

removal 2D convolution and DFT

Periodic noise removal Band-rejection and Notch filter

Page 28: Image Restoration

28

Additive White Gaussian Noise

DefinitionEach pixel in an image is disturbed by a Gaussian random variableWith zero mean and variance 2

WjHiNjiN

jiNjiXjiY

1,1),,0(~),(

),,(),(),(2

X: noise-free image, Y: noisy image

Note: unlike impulse noise situation, every pixel in the image contaminatedby AWGN is noisy

Page 29: Image Restoration

29

Numerical Example2 =1

X Y

128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128

128 128 129 127 129 126 126 128 126 128 128 129 129 128 128 127 128 128 128 129 129 127 127 128 128 129 127 126 129 129 129 128 127 127 128 127 129 127 129 128 129 130 127 129 127 129 130 128 129 128 129 128 128 128 129 129 128 128 130 129 128 127 127 126

Page 30: Image Restoration

EE465: Introduction to Digital Image Processing 30

MATLAB Command

>Y = IMNOISE(X,’gaussian',m,v)

>Y = X+m+randn(size(X))*v;or

Note:rand() generates random numbers uniformly distributed over [0,1]randn() generates random numbers observing Gaussian distributionN(0,1)

Page 31: Image Restoration

EE465: Introduction to Digital Image Processing 31

Image Denoising

Noisy image Y

filteringalgorithm

Question: Why not use median filtering?Hint: the noise type has changed.

X̂denoisedimage

Page 32: Image Restoration

32

Fourier Series (2D case)

m n

nwmwjenmfwwF )(21

21),(),(

Note that the input signal is discrete while its FT is a continuous function

),(),( nmhnmf spatial-domain convolution

),(),( 2121 wwHwwFfrequency-domain multiplication

Page 33: Image Restoration

EE465: Introduction to Digital Image Processing 33

Filter Examples Low-pass (LP)

h1(n)=[1,1]

|h1(w)|=2cos(w/2)1D

h(n)=[1,1;1,1]

|h(w1,w2)|=4cos(w1/2)cos(w2/2)2D

w1

w2

|h(w1,w2)|

Page 34: Image Restoration

34

Image DFT Example

Original ray image X choice 1: Y=fft2(X)

Page 35: Image Restoration

35

Image DFT Example (Con’t)

choice 1: Y=fft2(X) choice 2: Y=fftshift(fft2(X))Low-frequency at the centerLow-frequency at four corners

FFTSHIFT Shift zero-frequency component to center of spectrum.

Page 36: Image Restoration

36

Gaussian Filter

)2

exp(),( 2

22

21

21 wwwwH

)2

exp(),( 2

22

nm

nmh

FT

>h=fspecial(‘gaussian’, HSIZE,SIGMA);MATLAB code:

Page 37: Image Restoration

37

(=1)PSNR=24.4dB

Image Example

PSNR=20.2dB

noisy

(=25)

denoised denoised

(=1.5)PSNR=22.8dB

Matlab functions: imfilter, filter2

Page 38: Image Restoration

Hammer-Nail Analogy

38

Gaussian filter

median filter

salt-pepper/impulse noise

Gaussian noise

periodic noise???

Page 39: Image Restoration

39

Image Denoising Introduction Impulse noise removal

Median filtering Additive white Gaussian noise

removal 2D convolution and DFT

Periodic noise removal Band-rejection and Notch filter

Page 40: Image Restoration

EE465: Introduction to Digital Image Processing 40

Periodic Noise Source: electrical or electromechanical

interference during image acquistion Characteristics

Spatially dependent Periodic – easy to observe in frequency

domain Processing method

Suppressing noise component in frequency domain

Page 41: Image Restoration

41

Image Example

spatial

Frequency (note the four pairs of bright dots)

Page 42: Image Restoration

42

Band Rejection Filter

otherwise

WDwwWDwwH1

220),(

22

21

21

w1

w2

Page 43: Image Restoration

43

Image Example

Before filtering After filtering