gradient-domain image processing - computer...

139
Gradient-domain image processing 15-463, 15-663, 15-862 Computational Photography Fall 2018, Lecture 10 http://graphics.cs.cmu.edu/courses/15-463

Upload: others

Post on 21-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Gradient-domain image processing

15-463, 15-663, 15-862Computational Photography

Fall 2018, Lecture 10http://graphics.cs.cmu.edu/courses/15-463

Page 2: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Course announcements

• Homework 3 is out.- (Much) smaller than homework 2, but you should still start early to take advantage of bonus questions.- Requires a camera with flash for the second part.

• Grades for homework 1 have been posted.

• Make-up lecture will be scheduled soon.- What day does majority of the class prefer?

• How was Ravi’s lecture on Monday?

• Thoughts on homework 2?

Page 3: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Overview of today’s lecture

• Gradient-domain image processing.

• Basics on images and gradients.

• Integrable vector fields.

• Poisson blending.

• A more efficient Poisson solver.

• Poisson image editing examples.

• Flash/no-flash photography.

Page 4: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Slide credits

Many of these slides were adapted from:

• Kris Kitani (15-463, Fall 2016).• Fredo Durand (MIT).• James Hays (Georgia Tech).• Amit Agrawal (MERL).

Page 5: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Gradient-domain image processing

Page 6: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Someone leaked season 8 of Game of Thrones

or, more likely, they made some creative use of Poisson blending

Page 7: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Application: Poisson blending

originals copy-paste Poisson blending

Page 8: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

More applications

Removing Glass Reflections

Seamless Image Stitching

Page 9: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Yet more applications

Tonemapping

Fusing day and night photos

Page 10: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Entire suite of image editing tools

Page 11: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Main pipeline

Estimation

of Gradients

Manipulation of

Gradients

Non-Integrable

Gradient Fields

Reconstruction

from

Gradients

Images/Videos/

Meshes/Surfaces

Images/Videos/

Meshes/Surfaces

Page 12: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Basics of images and gradients

Page 13: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Image representation

We can treat images as scalar fields (i.e., two dimensional functions)

I(x,y): ℝ2 → ℝ

Page 14: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Image gradients

Convert the scalar field into a vector field through differentiation.

},{y

I

x

II

=),( yxI : ℝ2 → ℝ : ℝ2 → ℝ2scalar field vector field

Page 15: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Image gradients

Convert the scalar field into a vector field through differentiation.

},{y

I

x

II

=),( yxI : ℝ2 → ℝ : ℝ2 → ℝ2scalar field vector field

• How do we do this differentiation in real discrete images?

Page 16: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Finite differences

High-school reminder: definition of a derivative using forward difference

Page 17: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Finite differences

High-school reminder: definition of a derivative using forward difference

Alternative: use central difference

For discrete signals: Remove limit and set h = 2

How do you efficiently compute this?

Page 18: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Finite differences

High-school reminder: definition of a derivative using forward difference

Alternative: use central difference

For discrete signals: Remove limit and set h = 2

What convolution kernel does this correspond to?

Page 19: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Finite differences

High-school reminder: definition of a derivative using forward difference

Alternative: use central difference

For discrete signals: Remove limit and set h = 2

1 0 -1

-1 0 1 ?

?

Page 20: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Finite differences

High-school reminder: definition of a derivative using forward difference

Alternative: use central difference

For discrete signals: Remove limit and set h = 2

1 0 -1

1D derivative filter

Page 21: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Image gradients

Convert the scalar field into a vector field through differentiation.

},{y

I

x

II

=),( yxI : ℝ2 → ℝ : ℝ2 → ℝ2scalar field vector field

• How do we do this differentiation in real discrete images?

• Can we go in the opposite direction, from gradients to images?

Page 22: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Vector field integration

Two core questions:

• When is integration of a vector field possible?

• How can integration of a vector field be performed?

Page 23: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Integrable vector fields

Page 24: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Integrable fields

Given an arbitrary vector field (u, v), can we always integrate it into a scalar field I?

such that

𝜕𝐼

𝜕𝑥𝑥, 𝑦 = 𝑢(𝑥, 𝑦)

𝐼 𝑥, 𝑦 : ℝ2 → ℝ 𝑣 𝑥, 𝑦 : ℝ2 → ℝ𝑢 𝑥, 𝑦 : ℝ2 → ℝ

𝜕𝐼

𝜕𝑦𝑥, 𝑦 = 𝑣(𝑥, 𝑦)

?

Page 25: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Curl and divergenceCurl: vector operator showing the rate of rotation of a vector field.

Divergence: vector operator showing the isotropy of a vector field.

Do you know of some simpler versions of these operators?

IICurl = )(

IIDiv •= )(

Page 26: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

yyxx

yx

yxII

y

I

x

IIIdiv +=

+

=),(

Curl and divergenceCurl: vector operator showing the rate of rotation of a vector field.

Divergence: vector operator showing the isotropy of a vector field.

Can you use either of these operators to derive an integrability condition?

IICurl = )(xyyx

xy

yx

IIy

I

x

I

II

yx −=

=

det

Page 27: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Integrability condition

Curl of the gradient field should be zero:

What does that mean intuitively?

0)( =−=xyyx

IIICurl

Page 28: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Integrability condition

Curl of the gradient field should be zero:

0)( =−=xyyx

IIICurl

What does that mean intuitively?

• Same result independent of order of differentiation.

xyyxII =

Page 29: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Demonstration

Image Ix Iy

Div(Ix, Iy) Curl(Ix, Iy) Ixy Iyx

=

How do we compute this?

Page 30: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Basically a second derivative filter.• We can use finite differences to derive it, as with first derivative filter.

Laplace filter

?

first-orderfinite difference 1 0 -1

1D derivative filter

second-orderfinite difference

Laplace filter

Page 31: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Basically a second derivative filter.• We can use finite differences to derive it, as with first derivative filter.

Laplace filter

first-orderfinite difference 1 0 -1

1D derivative filter

second-orderfinite difference 1 -2 1

Laplace filter

Page 32: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Vector field integration

Two core questions:

• When is integration of a vector field possible?- Use curl to check for equality of mixed partial second derivatives.

• How can integration of a vector field be performed?

Page 33: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Different types of integration problems

• Reconstructing height field from gradientsApplications: shape from shading, photometric stereo

• Manipulating image gradientsApplications: tonemapping, image editing, matting, fusion, mosaics

• Manipulation of 3D gradientsApplications: mesh editing, video operations

Key challenge: Most vector fields in applications are not integrable.• Integration must be done approximately.

Page 34: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Poisson blending

Page 35: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Application: Poisson blending

originals copy-paste Poisson blending

Page 36: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

When blending, retain the gradient information as best as possible

36

Key idea

source destination copy-paste Poisson blending

Page 37: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

two signals regular blending blending derivatives

bright

dark

Poisson blending: 1D example

Page 38: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Definitions and notation

add image here

g: source function

S: destination

Ω: destination domain

f: interpolant function

f*: destination function

Notation

Which one is the unknown?

Page 39: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Definitions and notation

add image here

How should we determine f?• should it look like g?• should it look like f*?

g: source function

S: destination

Ω: destination domain

f: interpolant function

f*: destination function

Notation

Page 40: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Variational problem

what does this term do?

what does this term do?

Image gradient

Recall ...

Interpolation criterion

is this known?

“Variational” means optimization where the unknown is an

entire function

Page 41: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Variational problem

gradient of f looks like gradient of g

f is equivalent to f* at the boundaries

Image gradient

Recall ...

Interpolation criterion

Yes, since the source function g is known

“Variational” means optimization where the unknown is an

entire function

Page 42: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Poisson equation (with Dirichlet boundary conditions)

Laplacian

Gradient

Equivalently

Divergence

This is where Poissonblending comes from

what does this term do?

Page 43: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Poisson equation (with Dirichlet boundary conditions)

Laplacian

Gradient

Equivalently

Divergence

Laplacian of f same as g

Page 44: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Poisson equation (with Dirichlet boundary conditions)

Equivalently

so make these guys ...

the same

How can we do this?

Page 45: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Poisson equation (with Dirichlet boundary conditions)

Equivalently

So for each pixel p, do:How did we compute

the Laplacian?Or for discrete images:

Page 46: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Poisson equation (with Dirichlet boundary conditions)

Equivalently

So for each pixel p, do:

Or for discrete images:

0 1 0

1 -4 1

0 1 0

Recall...

Laplace filter

What’s known and what’s unknown?

Page 47: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Poisson equation (with Dirichlet boundary conditions)

Equivalently

So for each pixel p, do:

0 1 0

1 -4 1

0 1 0

Recall...

Laplace filterOr for discrete images:

f is unknown except at the boundary

g and its Laplacian are known

Page 48: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

In vector form:

(each pixel adds another ‘sparse’ row here)

Linear system of equations

WARNING: requires special treatment at the borders(target boundary values are same as source )

linear equation of N variables

one for each pixel in destination

We can rewrite this as

How would you solve this?

What is this?

0 ⋯ − 1 ⋯ − 1 4 − 1 ⋯ − 1 ⋯ 0

Page 49: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Solving the linear system

Convert the system to a linear least-squares problem:

Expand the error:

Set derivative to 0

Minimize the error:

Solve for x

Page 50: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Solving the linear system

Convert the system to a linear least-squares problem:

Expand the error:

Set derivative to 0

Minimize the error:

Solve for x

In Matlab:

f = A \ b

Note: You almost never want to compute the inverse of a matrix.

Page 51: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Integration procedures

• Poisson solver (i.e., least squares integration)+ Generally applicable.- Matrices A can become very large.

• Acceleration techniques: + (Conjugate) gradient descent solvers.+ Multi-grid approaches.+ Pre-conditioning.+ Quadtree decompositions.

• Alternative solvers: projection procedures.We will discuss one of these when we cover photometric stereo.

Page 52: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

A more efficient Poisson solver

Page 53: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Variational problem

gradient of f looks like gradient of g

f is equivalent to f* at the boundaries

Image gradient

Recall ...

Let’s look again at our optimization problem

Page 54: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Variational problem

gradient of f looks like gradient of g

f is equivalent to f* at the boundaries

Image gradient

Recall ...

Let’s look again at our optimization problem

And for discrete images:

1 0 -1

1

0

-1

𝜕

𝜕𝑥≈

𝜕

𝜕𝑦≈

Page 55: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Discrete problemWhat are G, f, and v?

Image gradient

Recall ...

Let’s look again at our optimization problem

And for discrete images:

1 0 -1

1

0

-1

𝜕

𝜕𝑥≈

𝜕

𝜕𝑦≈

We can use the gradient

approximation to discretize the

variational problem

We will ignore the boundary conditions

for now.min𝑓

𝐺𝑓 − 𝑣 2

Page 56: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Discrete problemmatrix G formed by stacking together discrete gradients

Image gradient

Recall ...

Let’s look again at our optimization problem

And for discrete images:

1 0 -1

1

0

-1

𝜕

𝜕𝑥≈

𝜕

𝜕𝑦≈

We can use the gradient

approximation to discretize the

variational problem

We will ignore the boundary conditions

for now.min𝑓

𝐺𝑓 − 𝑣 2

vectorized version of the unknown image

vectorized version of the target gradient field

Page 57: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Discrete problemmatrix G formed by stacking together discrete gradients

Image gradient

Recall ...

Let’s look again at our optimization problem

And for discrete images:

1 0 -1

1

0

-1

𝜕

𝜕𝑥≈

𝜕

𝜕𝑦≈

We can use the gradient

approximation to discretize the

variational problem

We will ignore the boundary conditions

for now.min𝑓

𝐺𝑓 − 𝑣 2

vectorized version of the unknown image

vectorized version of the target gradient field

Page 58: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Discrete problemmatrix G formed by stacking together discrete gradients

Image gradient

Recall ...

Let’s look again at our optimization problem

And for discrete images:

1 0 -1

1

0

-1

𝜕

𝜕𝑥≈

𝜕

𝜕𝑦≈

How do we solve this optimization

problem?min𝑓

𝐺𝑓 − 𝑣 2

vectorized version of the unknown image

vectorized version of the target gradient field

Page 59: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Approach 1: Compute stationary points

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

… we compute its derivative:

𝜕𝐸

𝜕𝑓=?

Page 60: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Approach 1: Compute stationary points

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

… we compute its derivative:

𝜕𝐸

𝜕𝑓= 𝐺𝑇𝐺𝑓 − 𝑣

… and we do what with it?

Page 61: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Approach 1: Compute stationary points

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

… we compute its derivative:

𝜕𝐸

𝜕𝑓= 𝐺𝑇𝐺𝑓 − 𝑣

… and we set that to zero:

𝜕𝐸

𝜕𝑓= 0 ⇒ 𝐺𝑇𝐺𝑓 = 𝑣

What is this matrix?

Page 62: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Approach 1: Compute stationary points

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

… we compute its derivative:

𝜕𝐸

𝜕𝑓= 𝐺𝑇𝐺𝑓 − 𝑣

… and we set that to zero:

𝜕𝐸

𝜕𝑓= 0 ⇒ 𝐺𝑇𝐺𝑓 = 𝑣

It is equal to the Laplacian matrix A we

derived previously!

Page 63: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Poisson equation (with Dirichlet boundary conditions)

Reminder from variational case

So for each pixel p, do:

Or for discrete images:

0 1 0

1 -4 1

0 1 0

Recall...

Laplace filter

What’s known and what’s unknown?

Page 64: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

In vector form:

(each pixel adds another ‘sparse’ row here)

Linear system of equations

linear equation of N variables

one for each pixel in destination

Reminder from variational case

Same system as:

What is this?

0 ⋯ − 1 ⋯ − 1 4 − 1 ⋯ − 1 ⋯ 0

𝐺𝑇𝐺𝑓 = 𝑣

We arrive at the same system, no matter whether we discretize the continuous Laplace equation or the variational optimization problem.

Page 65: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Approach 1: Compute stationary points

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

… we compute its derivative:

𝜕𝐸

𝜕𝑓= 𝐺𝑇𝐺𝑓 − 𝑣

… and we set that to zero:

𝜕𝐸

𝜕𝑓= 0 ⇒ 𝐺𝑇𝐺𝑓 = 𝑣

Solving this is exactly as expensive as what we

had before.

Page 66: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Approach 2: Use gradient descent

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

… we compute its derivative:

𝜕𝐸

𝜕𝑓= 𝐺𝑇𝐺𝑓 − 𝑣 = 𝐴𝑓 − 𝑣 ≡ 𝑟

We call this term the residual

Page 67: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Approach 2: Use gradient descent

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

… we compute its derivative:

𝜕𝐸

𝜕𝑓= 𝐺𝑇𝐺𝑓 − 𝑣 = 𝐴𝑓 − 𝑣 ≡ 𝑟

We call this term the residual

… and then we iteratively compute a solution:

𝑓𝑖+1 = 𝑓𝑖 − η𝑖𝑟𝑖

are positive step sizesη𝑖for i = 0, 1, …, N, where

Page 68: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Selecting optimal step sizes

Make derivative of loss function with respect to equal to zero:η𝑖

𝐸 𝑓𝑖+1 = 𝐺 𝑓𝑖 − η𝑖𝑟𝑖 − 𝑣2

𝜕𝐸 𝑓𝑖+1

𝜕𝑟𝑖= 𝑣 − 𝐴 𝑓𝑖 − η𝑖𝑟𝑖 𝑇

𝑟𝑖 = 0 ⇒ η𝑖 =𝑟𝑖 𝑇

𝑟𝑖

𝑟𝑖 𝑇𝐴𝑟𝑖

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

Page 69: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Gradient descent

Minimize by iteratively computing:

𝑓𝑖+1 = 𝑓𝑖 − η𝑖𝑟𝑖 , for i = 0, 1, …, Nη𝑖 =𝑟𝑖 𝑇

𝑟𝑖

𝑟𝑖 𝑇𝐴𝑟𝑖𝑟𝑖 = 𝑣 − 𝐴𝑓𝑖 ,

Is this cheaper than the pseudo-inverse approach?

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

Page 70: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Gradient descent

Minimize by iteratively computing:

𝑓𝑖+1 = 𝑓𝑖 − η𝑖𝑟𝑖 , for i = 0, 1, …, Nη𝑖 =𝑟𝑖 𝑇

𝑟𝑖

𝑟𝑖 𝑇𝐴𝑟𝑖𝑟𝑖 = 𝑣 − 𝐴𝑓𝑖 ,

Is this cheaper than the pseudo-inverse approach?

• We never need to compute A, only its products with vectors f, r.

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

Page 71: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Gradient descent

Minimize by iteratively computing:

𝑓𝑖+1 = 𝑓𝑖 − η𝑖𝑟𝑖 , for i = 0, 1, …, Nη𝑖 =𝑟𝑖 𝑇

𝑟𝑖

𝑟𝑖 𝑇𝐴𝑟𝑖𝑟𝑖 = 𝑣 − 𝐴𝑓𝑖 ,

Is this cheaper than the pseudo-inverse approach?

• We never need to compute A, only its products with vectors f, r.• Vectors f, r are images.

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

Page 72: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Gradient descent

Minimize by iteratively computing:

𝑓𝑖+1 = 𝑓𝑖 − η𝑖𝑟𝑖 , for i = 0, 1, …, Nη𝑖 =𝑟𝑖 𝑇

𝑟𝑖

𝑟𝑖 𝑇𝐴𝑟𝑖𝑟𝑖 = 𝑣 − 𝐴𝑓𝑖 ,

Is this cheaper than the pseudo-inverse approach?

• We never need to compute A, only its products with vectors f, r.• Vectors f, r are images.• Because A is the Laplacian matrix, these matrix-vector products can be efficiently computed

using convolutions with the Laplacian kernel.

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

Page 73: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

In practice: conjugate gradient descent

Minimize by iteratively computing:

𝑓𝑖+1 = 𝑓𝑖 + η𝑖𝑑𝑖 , for i = 0, 1, …, N

η𝑖 =𝑑𝑖 𝑇

𝑟𝑖

𝑑𝑖 𝑇𝐴𝑑𝑖

𝑟𝑖 = 𝑣 − 𝐴𝑓𝑖 ,

𝛽𝑖+1 =𝑟𝑖+1 𝑇

𝑟𝑖+1

𝑟𝑖 𝑇𝑟𝑖

𝑑𝑖+1 = 𝑟𝑖+1 + 𝛽𝑖+1𝑑𝑖 , • Smarter way for selecting update directions

• Everything can still be done using convolutions

Given the loss function:

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

Page 74: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Note: initialization

Does the initialization f0 matter?

Page 75: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Note: initialization

Does the initialization f0 matter?

• It doesn’t matter in terms of what final f we converge to, because the loss function is convex.

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

Page 76: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Note: initialization

Does the initialization f0 matter?

• It doesn’t matter in terms of what final f we converge to, because the loss function is convex.

𝐸 𝑓 = 𝐺𝑓 − 𝑣 2

• It does matter in terms of convergence speed.• We typically use a multi-grid approach:

- Solve an initial problem for a very low-resolution f (e.g., 2x2).- Use the solution to initialize gradient descent for a higher resolution f (e.g., 4x4).- Use the solution to initialize gradient descent for a higher resolution f (e.g., 8x8).

…- Use the solution to initialize gradient descent for an f with the original resolution NxN.

Page 77: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Poisson image editing examples

Page 78: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Photoshop’s “healing brush”

Slightly more advanced version of what we covered here:• Uses higher-order derivatives

Page 79: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Contrast problem

Loss of contrast when pasting from dark to bright:• Contrast is a multiplicative property.• With Poisson blending we are matching linear differences.

Page 80: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Contrast problem

Loss of contrast when pasting from dark to bright:• Contrast is a multiplicative property.• With Poisson blending we are matching linear differences.

Solution: Do blending in log-domain.

Page 81: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

More blending

copy-paste Poisson blendingoriginals

Page 82: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Blending transparent objects

Page 83: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Blending objects with holes

Page 84: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Editing

Page 85: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Concealment

How would you do this with Poisson blending?

Page 86: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Concealment

How would you do this with Poisson blending?

• Insert a copy of the background.

Page 87: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Texture swapping

Page 88: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Special case: membrane interpolation

How would you do this?

Page 89: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Special case: membrane interpolation

How would you do this?

Poisson problem

Laplacian problem

Page 90: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Flash/no-flash photography

Page 91: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Red Eye

Page 92: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Unflattering Lighting

Page 93: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Motion Blur

Page 94: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Noise

Page 95: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

A lot of Noise

Page 96: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Ruined Ambiance

Page 97: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

No-FlashFlash

+ Low Noise+ Sharp- Artificial Light- Jarring Look

- High Noise- Lacks Detail+ Ambient Light+ Natural Look

Page 98: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Image acquisition

Lock Focus& Aperture

1

time

Page 99: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Image acquisition

1/30 sISO 3200

No-Flash ImageLock Focus& Aperture

21

time

Page 100: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Image acquisition

1/30 sISO 3200

1/125 sISO 200

No-Flash ImageLock Focus& Aperture

Flash Image

2 31

time

Page 101: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Denoising Result

Page 102: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

• Show a larger result here

No-Flash

Page 103: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Denoising Result

Page 104: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Key idea

Denoise the no-flash image while maintaining the edge structure of the flash image• How would you do this using the image editing techniques we’ve learned about?

Page 105: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Denoising with bilateral filtering

noisy input bilateral filtering median filtering

Page 106: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Denoising with bilateral filtering

• However, results still have noise or blur (or both)

ambient

flashBilateral

filter

Page 107: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Denoising with joint bilateral filtering

• In the flash image there are much more details

• Use the flash image F to find edges

Page 108: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Denoising with joint bilateral filtering

Bilateral filter

Joint Bilateral filter

The difference

Page 109: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Not all edges in the flash image are real

Can you think of any types of edges that may exist in the flash image but not the ambient one?

Page 110: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Not all edges in the flash image are real

shadows

specularities

• May cause over- or under-blur in joint bilateral filter

• We need to eliminate their effect

Page 111: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Detecting shadows

• Observation: the pixels in the flash shadow should be similar to the ambient image.

• Not identical:

1. Noise.

2. Inter-reflected flash.

• Compute a shadow mask.

• Take pixel p if

• is manually adjusted

• Mask is smoothed and dilated

Page 112: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Detecting specularities

• Take pixels where sensor input is close to maximum (very bright).

• Over fixed threshold

• Create a specularity mask.

• Also smoothed.

• M – the combination of shadow and specularity masks:

Where Mp=1, we use ABase. For other pixels we use ANR.

Page 113: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Detail transfer

• Denoising cannot add details missing in the ambient image

• Exist in flash image because of high SNR

• We use a quotient image:

• Multiply with ANR to add the details

• Masked in the same way

Reduces the effect of

noise in F

Why does this quotient image make sense for detail?

Bilateral filtered

Page 114: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Detail transfer

• Denoising cannot add details missing in the ambient image

• Exist in flash image because of high SNR

• We use a quotient image: Reduces the effect of

noise in F

Page 115: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Full pipeline

Page 116: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Demonstration

ambient-only joint bilateral and detail transfer

Page 117: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Can we do similar flash/no-flash fusion tasks with gradient-domain processing?

Page 118: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Removing self-reflections and hot-spotsAmbient Flash

Page 119: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Removing self-reflections and hot-spotsAmbient Flash

Hands

Face

Tripod

Page 120: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Removing self-reflections and hot-spotsResultAmbient

Flash

Reflection Layer

Page 121: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Idea: look at how gradients are affectedSame gradient vector direction

Flash Gradient Vector

Ambient Gradient Vector

Ambient Flash

No reflections

Page 122: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Idea: look at how gradients are affectedReflection Ambient Gradient

VectorDifferent gradient vector direction

With reflections

Ambient Flash

Flash Gradient Vector

Page 123: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Idea: look at how gradients are affectedReflection Ambient Gradient

VectorDifferent gradient vector direction

With reflections

Ambient Flash

Flash Gradient Vector

Page 124: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Gradient projectionsResidual Gradient Vector

Result Gradient Vector

Result Residual

Flash Gradient Vector

Ambient Flash

Page 125: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Flash/no-flash with gradient-domain processing

2D

Integration

Flash

Ambient

X

Y

X

Y

Intensity Gradient

Vector Projection

Result X

Result Y

Result

2D Integration

Page 126: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Flash

Page 127: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

No-Flash

Page 128: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

No-Flash

Page 129: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Result

Page 130: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Flash

Page 131: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

No-Flash

Page 132: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

No-Flash

Page 133: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Result

Page 134: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Flash

Page 135: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

No-Flash

Page 136: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Flash

Page 137: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

No-Flash

Page 138: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

Result

Page 139: Gradient-domain image processing - Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2018_fall/lectures/lecture10.pdf · Applications: tonemapping, image editing, matting, fusion,

ReferencesBasic reading:• Szeliski textbook, Sections 3.13, 3.5.5, 9.3.4, 10.4.3.• Pérez et al., “Poisson Image Editing,” SIGGRAPH 2003.

The original Poisson Image Editing paper.• Agrawal and Raskar, “Gradient Domain Manipulation Techniques in Vision and Graphics,” ICCV 2007 course, http://www.amitkagrawal.com/ICCV2007Course/

A great resource (entire course!) for gradient-domain image processing.• Petschnigg et al., “Digital photography with flash and no-flash image pairs,” SIGGRAPH 2004.• Eisemann and Durand, “Flash Photography Enhancement via Intrinsic Relighting,” SIGGRAPH 2004.

The first two papers exploring the idea of photography with flash and no-flash pairs, both using variants of the joint bilateral filter.• Agrawal et al., “Removing Photography Artifacts Using Gradient Projection and Flash-Exposure Sampling,” SIGGRAPH 2005.

A subsequent paper on photography with flash and no-flash pairs, using gradient-domain image processing.

Additional reading:• Georgiev, “Covariant Derivatives and Vision,” ECCV 2006.

An paper from Adobe on the version of Poisson blending implemented in Photoshop’s “healing brush”.• Elder and Goldberg, “Image editing in the contour domain”, PAMI 2001.

One of the very first papers discussing gradient-domain image processing.• Szeliski, “Locally adapted hierarchical basis preconditioning,” SIGGRAPH 2006.

A standard reference on multi-grid and preconditioning techniques for accelerating the Poisson solver.• Bhat et al., “Fourier Analysis of the 2D Screened Poisson Equation for Gradient Domain Problems,” ECCV 2008.

A paper discussing the (Fourier) basis projection approach for solving the Poisson integration problem.• Bhat et al., “GradientShop: A Gradient-Domain Optimization Framework for Image and Video Filtering,” ToG 2010.

A paper describing gradient-domain processing as a general image processing paradigm, which can be used for a broad set of applications beyond blending, including tone-mapping, colorization, converting to grayscale, edge enhancement, image abstraction and non-photorealistic rendering.

• Krishnan and Fergus, “Dark Flash Photography,” SIGGRAPH 2009.A paper proposing doing flash/no-flash photography using infrared flash lights.

• Kettunen et al., “Gradient-domain path tracing,” SIGGRAPH 2015.In addition to editing images in the gradient-domain, we can also directly render them in the gradient-domain.

• Tumblin et al., “Why I want a gradient camera?” CVPR 2005.We can even directly measure images in the gradient domain, using so-called gradient cameras.