53
Computer Vision - Computer Vision - Restoration Restoration Hanyang University Jong-Il Park

CV Restoration

Embed Size (px)

DESCRIPTION

vision

Citation preview

Page 1: CV Restoration

Computer Vision -Computer Vision -RestorationRestoration

Hanyang University

Jong-Il Park

Page 2: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Restoration vs. EnhancementRestoration vs. Enhancement

Restoration

Objective process

A priori knowledge on degradation model

Modeling the degradation and applying the inverse process to recover the original

To improve an image in some predefined sense

Enhancement

Subjective process

Page 3: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Restoration processRestoration process

Page 4: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Noise modelsNoise models

Assume noise is independent of spatial coordinates and it isuncorrelated w.r.t. the image.

• Gaussian: electronic circuit noise, sensor noise• Rayleigh: range images• Exponential and gamma: laser images• impulse(salt-and-pepper): faulty switching

Page 5: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Sample noisy imagesEg. Sample noisy images

Page 6: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Sample noisy images(cont.)Eg. Sample noisy images(cont.)

Page 7: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Periodic noisePeriodic noise

Spatially dependent noise Periodic noise can be

reduced significantly via frequency domain filtering

Page 8: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Estimation of noise parametersEstimation of noise parameters

PDF from small patches

Page 9: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

When the only degradation is noiseWhen the only degradation is noise

Periodic noise subtraction gives a good result Random noise mean filter, order-statistics filter,…

),(),(),(

and

),(),(),(

vuNvuFvuG

yxyxfyxg

Page 10: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Mean filtersMean filters

Arithmetic mean filters For Gaussian or uniform noise

Geometric mean filters For Gaussian or uniform noise

Harmonic mean filters Work well for salt noise but fail for pepper noise

Contraharmonic mean filters Suited for impulse noise but require identification(salt

or pepper)

Page 11: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Arithmetic & Geometric mean filterArithmetic & Geometric mean filter

Page 12: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Contraharmonic filtersContraharmonic filters

Q<0 : eliminates salt noiseQ=-1 harmonic mean filter

Q=0 : arithmetic mean filter Q>0: eliminates pepper noise

xy

xy

Sts

Q

Sts

Q

tsg

tsg

yxf

),(

),(

1

),(

),(

),(ˆ

Page 13: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Contraharmonic filtersEg. Contraharmonic filters

Page 14: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Wrong sign in contraharmonic filtersWrong sign in contraharmonic filters

Disaster!

Page 15: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Order-Statistics filtersOrder-Statistics filters

Median filter Max filter Min filter Midpoint filter Alpha-trimmed mean filter

Page 16: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Median filtersMedian filters

33x3x3medianmedian

33x3x3medianmedian

33x3x3medianmedian

blurred

Page 17: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Max and Min filterMax and Min filter

• Max filter • Min filterRemoves pepper noiseRemoves dark pixels

Removes salt noiseRemoves light pixelsMakes dark objects larger

Page 18: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. ComparisonEg. Comparison

(a) Additive uniformnoise

(b) (a)+additive S&P

5x5 arithmetic mean 5x5 geometric mean

5x5 median 5x5 alpha-trimmedMean(d=5)

Page 19: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Adaptive filtersAdaptive filters

Behavior changes locally based on statistical characteristics of local support

Simple adaptive filter based on mean and variance1. If global_var is zero, then f(x,y)=g(x,y)

2. If local_var>global_var, then f(x,y)=g(x,y) (high local var edge should be preserved)

3. If local_var==global_var, then arithmetic mean filtering

Page 20: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Adaptive filterEg. Adaptive filter

Page 21: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Adaptive median filterAdaptive median filter

Cope with impulse noise with large probability Preserve detail while smoothing non-impulse noise

Level A:A1=zmed-zmin

A2=zmed-zmax

If A1>0 AND A2<0, go to level BElse increase the window sizeIf window size<=Smax repeat level AElse output zxy

Level B:B1=zxy-zmin

B2=zxy-zmax

If B1>0 AND B2<0, output zxy

Else output zmed

Algorithm

Page 22: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Adaptive median filterEg. Adaptive median filter

median adaptive median

Page 23: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Periodic noise reductionPeriodic noise reduction

By frequency domain filtering Band reject filter

Page 24: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Periodic noise reductionEg. Periodic noise reduction

Page 25: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Noise extractionNoise extraction

By bandpass filter

Help understanding noise pattern

Page 26: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Notch filtersNotch filters

Page 27: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Notch filteringEg. Notch filtering

Removing sensor scan-line patterns

Page 28: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Optimum notch filteringOptimum notch filtering

First isolating the principal contributions of the interference pattern

Then subtracting weighted portion of the pattern from the corrupted image

Page 29: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Periodic interference(1/3)Eg. Periodic interference(1/3)

Noisy image

Page 30: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Periodic interference(2/3)Eg. Periodic interference(2/3)

Extraction of noise interference pattern

Page 31: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Periodic interference(3/3)Eg. Periodic interference(3/3)

Restored image by subtracting weighted portion of periodic interference (Refer to the derivation of weights in pp.250-252)

Page 32: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Linear, Position-Invariant DegradationLinear, Position-Invariant Degradation

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

:DomainFrequency

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

:Domain Spatial

vuNvuFvuHvuG

yxyxfyxhyxg

Page 33: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Degradation knowledgeDegradation knowledge

Degradation knowledge about 1. A priori (known)

2. A posteriori (unknown) blind restoration or blind deconvolution

fg

H

Restoration:Restoration:determine the original image ,

given the observed image and

knowledge about the degradation (H).

Page 34: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Fundamental issueFundamental issue

Restoration problem

restoration is to find , such that

but, 1. does not exist: singular

2. may exist, but not be unique: ill-conditioned

3. may exist and unique, but there exists ,

which can be made arbitrarily small, such that

which is not negligible

Image restoration is ill-conditioned at best and Image restoration is ill-conditioned at best and singular at worstsingular at worst

gfT }{1T fgT }{1

1T1T1T

,,}{1 fgT

Page 35: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Estimation of degradation functionEstimation of degradation function

Approaches

Observation

Experimentation

Mathematical modeling

Page 36: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Estimation by observationEstimation by observation

Looking at a small section of the image containing simple structures and then obtaining degradation function

Observed sub-image:

Estimate of original image:

),( yxg s),(ˆ yxf s

),(ˆ),(

),(vuF

vuGvuH

s

ss

Page 37: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Estimation by experimentationEstimation by experimentation

Possible only if equipment similar to the equipment used to acquire the degraded images is available

Eg. Use an impulse

Page 38: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Estimation by modelingEstimation by modeling Based on either physical characteristics or basic

principles

Eg.1. Physical characteristics: atmospheric turbulence

Eg.2. Math derivation: motion blur Starting from

After some manipulation(p.259)

Setting the motion model, we obtain the degradation func.

6/5)( 22

),( vukevuH

dtevuHT tvytuxj 0

)]()([2 00),(

T

dttyytxxfyxg0 00 )](),([),(

Page 39: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg.1. Physical modelEg.1. Physical model

Atmospheric turbulence

Page 40: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg.2. Math modelingEg.2. Math modeling

Motion blur

Page 41: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Restoration methodsRestoration methods

Inverse filtering Wiener filtering Constrained least square filtering Geometric mean filtering Etc..

Page 42: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Inverse filteringInverse filtering

Poor performance! Very sensitive to noise

),(),(),(),( vuNvuFvuHvuG

),(

),(),(),(ˆ

vuH

vuNvuFvuF

),(

),(),(ˆ

vuH

vuGvuF

Noise amplificationwhen H(u,v) is small

Page 43: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Inverse filteringEg. Inverse filtering

Page 44: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Minimum mean-square error filterMinimum mean-square error filter

Necessary to handle noise explicitly Statistical characteristics of noise should be

incorporated into the restoration process MMSE filter

To find an estimate of the uncorrupted image such that the mean square error between them is minimized:

Assume: the noise and the image are uncorrelated The one or the other has zero mean The gray levels in the estimate are a linear function of

the levels in the degraded image Derivation: Homework

})ˆ{( 22 ffEe

f̂ f

Page 45: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

MMSE filter (cont.)MMSE filter (cont.)

Frequency domain expression:

Approximation of the Wiener filter

),(),(/),(|),(|

),(*

),(),(|),(|),(

),(),(*),(ˆ

2

2

vuGvuSvuSvuH

vuH

vuGvuSvuHvuS

vuSvuHvuF

f

f

f

Wiener filter

),(|),(|

|),(|

),(

1),(ˆ

2

2

vuGKvuH

vuH

vuHvuF

PS of noise PS of image f

Page 46: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Wiener filteringEg. Wiener filtering

Using the approximation K is chosen interactively

Page 47: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Restoration by Wiener filterEg. Restoration by Wiener filter motion blurmotion blur

Severe noise

Moderate noise

Negligible noise

Page 48: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Constrained Least Square FilteringConstrained Least Square Filtering

Difficulty in Wiener filter The power spectra of the undegraded image and noise

must be known Minimization in a statistical sense

The constrained LS filtering requires knowledge of

Mean of the noise Variance of the noise

Optimal result for each image

Page 49: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Vector-matrix form of convolutionVector-matrix form of convolution

g: MN-vector (lexicographical order of an image) f: MN-vector H: MNxMN matrix

ηHfg

Page 50: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Formulation: Constrained LS filterFormulation: Constrained LS filter

To find the minimum of a criterion function C defined as

subject to the constraint

where is the Euclidean vector norm

1

0

1

0

22 ),(M

x

N

y

yxfC

22 ||||||ˆ|| ηfHg

www T2||||

Page 51: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Freq. Domain Sol.Freq. Domain Sol.

: adjustable parameter

: Fourier transform of the Laplacian operator

),(|),(||),(|

),(* ),(ˆ

22vuG

vuPvuH

vuHvuF

),( vuP

Page 52: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Eg. Constrained LS filterEg. Constrained LS filter

Significant improvement over Wiener filter

Page 53: CV Restoration

            

Department of Computer Science and Engineering, Hanyang University

Procedure for computing Procedure for computing

Define a residual vector

Adjust so that

Calculation

a 22 ||||||||)( ηr

fHgr ˆ

][|||| 222 mMN η

In general, automatically determined restoration filteryields inferior results to manual adjustment of filter parameters

iteration