cs448f: image processing for photography and vision · 2009. 11. 17. · problems in photography...

38
CS448f: Image Processing For Photography and Vision Deconvolution

Upload: others

Post on 26-Sep-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

CS448f: Image Processing For Photography and Vision

Deconvolution

Page 2: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Assignment 3

• Competition

• Lessons Learned

Page 3: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Project

• Proposals due Thursday

• Everyone should have a pretty good idea of what they plan to do at this stage

• Presentations begin next Tuesday

• Schedule?

Page 4: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Problems in PhotographyLinear Filters Non-Linear

FiltersAlignment Wavelets Gradient

Domain

Misfocus or Lens Blur

Sharpening SharpeningFocal StacksPanoramas

Sharpening ?

Motion Blur Sharpening Sharpening ? ? ?

Noise BlurringBilateralNonlocalMeans

Aligned Averaging

Wavelet Shrinkage

?

DynamicRange

?Tone-

MappingHDR

Acquisition?

Tone-Mapping

CompositionMulti-Band

Blending? Panoramas ?

Poisson Blending

Page 5: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Problems in PhotographyLinear Filters

Non-LinearFilters

Alignment Wavelets Gradient Domain

Deconvolution

Misfocus or Lens Blur

Sharpening SharpeningFocal StacksPanoramas

Sharpening ?

Motion Blur Sharpening Sharpening ? ? ?

Noise BlurringBilateralNonlocalMeans

Aligned Averaging

Wavelet Shrinkage

?

DynamicRange

?Tone-

MappingHDR

Acquisition?

Tone-Mapping

?

CompositionMulti-Band

Blending? Panoramas ?

Poisson Blending

?

Page 6: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Motion Blur (Handheld 200mm 1/50 s)

Page 7: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Motion Blur (Handheld 200mm, 1/50s)

Page 8: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Less Motion Blur (1/640s)

Page 9: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Motion Blur (Rolling the camera)

Page 10: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Motion Blur = Convolution

* =

Page 11: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Convolution = Linear Operator

• Image * kernel = blurry

• Km = b

– K = the blur (may or may not be known)

– m = the unknown good image

– b = the known blurry image

• K is known = nonblind deconvolution

• K is unknown = blind deconvolution

Page 12: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Estimating K

• Include an accelerometer

• Look for the path traced by bright points

• Bounce back and forth between estimating K and estimating m

– Deconvolution using Natural Image Priors

• Levin et al. 2007

Page 13: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Deconvolution = Least Squares

• Assuming we know K

• Find m such that Km = b

• Alternatively, minimize (Km-b)2

Page 14: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Solution Methods: Input

Page 15: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Solution Methods: Gradient Descent

Page 16: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Solution Methods: Richardson-Lucy

Page 17: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Solution Methods: Richardson-Lucy

• m *= KT(b/(Km))

• Like a multiplicative gradient descent

• Each step conserves average brightness in each region

• ImageStack -load blurry.tmp -loop --dup --load kernel.tmp --pull 1 --convolve --pull 1 --pop --load blurry.tmp --divide --load kernel.tmp --flip x --flip y --pull 1 --convolve --pull 1 --pop --multiply --save rl.tmp --display

Page 18: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

High-Frequency Junk

Page 19: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Priors

• The result image above satisfies the equation:

– Km = b

• Why does it look bad?

Page 20: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Priors

• The result image above satisfies the equation:

– Km = b

• Why does it look bad?

• There’s extra high-frequency junk

Page 21: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Gradient Magnitude

Original Richardson Lucy Result

Page 22: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Gradient Magnitude

Original Richardson Lucy Result

Page 23: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Let’s also minimize gradients

• Km = b

• Dxm = 0

• Dym = 0

• Solving this least-squares minimizes:

|Km-b|2 + |Dxm|2 + |Dym|2

= L2-norm of error + L2-norm of gradient field

Page 24: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Let m = correct answer

|Km - b|2 |Dxm|2 + |Dym|2

Page 25: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Let m = Richardson Lucy

|Km - b|2 |Dxm|2 + |Dym|2

Page 26: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Let m = blurry input

|Km - b|2 |Dxm|2 + |Dym|2

Page 27: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Gradient Magnitude is a Bad Prior

• It strongly prefers blurry output if at all possible

• The prior and the error fight each other

• What’s a better prior?

Page 28: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Strong Gradients are Sparse

Page 29: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Strong Gradients are Sparse

Page 30: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Our old prior:

Original Grad ^ 2 Motion-Blurred Grad ^ 2

Page 31: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Slightly better to count the number of large edges, and minimize that

Original Grad ^ 0.125 Motion-Blurred Grad ^ 0.125

Page 32: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Given a black-white transition...

Sum of gradients raised to power > 1 prefers smooth edges:

Sum of gradients raised to power < 1 prefers sharp edges:

Page 33: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Optimization

• Solving this least-squares minimizes:

– |Km-b|2 + |Dxm|2 + |Dym|2

• We want to minimize something like this:

– |Km-b|2 + |Dxm|½ + |Dym|½

• No longer a convex optimization problem...

• Can still use gradient descent to find a local minima

– it picks a sensible looking place for each edge

Page 34: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Some results

• http://graphics.ucsd.edu/~neel/dissertation/chapter5results/

Page 35: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

More Fun in the Gradient Domain

• So if gradients should be sparse, and we see a gradient that looks like this:

• Why not convert it to this:

0 0 1 3 5 6 4 1 0 0

0 0 0 1 3 15 1 0 0 0

0 0 1 3 5 6 4 1 0 0

Page 36: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

More Fun in the Gradient Domain

• If it works: call it deblurring

• If it doesn’t: call it a “painterly effect”

Page 37: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Input

Page 38: CS448f: Image Processing For Photography and Vision · 2009. 11. 17. · Problems in Photography Linear Filters Non-Linear Filters Alignment Wavelets Gradient Domain Deconvolution

Output