31
Gradient Image Blending CS 7490 | Advanced Image Synthesis | Project Prashanth Palanthandalam

Gradient image blending

Embed Size (px)

Citation preview

Page 1: Gradient image blending

Gradient Image BlendingCS 7490 | Advanced Image Synthesis | Project

Prashanth Palanthandalam

Page 2: Gradient image blending

Based on

Poisson Image Editing by Perez et. al.

SIGGRAPH 2003

Page 3: Gradient image blending

Example

Page 4: Gradient image blending

The Challenge

To seamlessly blend a pixel into

another image, it’s neighboring

pixel values must also be known.

Page 5: Gradient image blending

We need to consider

Image Gradients

which quantitatively indicate

how pixels change with respect

to their neighbors.

Page 6: Gradient image blending

Alter the Boundary Pixels of

IMAGE 2 to be equal to

corresponding pixels of

IMAGE 1.

But preserve the GRADIENT

for the IMAGE 2 pixels inside

the region.

Page 7: Gradient image blending

Mathematically, we have

A background image A

A foreground image B

A mask M

An improvised version of B Cwhich blends with A .

Page 8: Gradient image blending
Page 9: Gradient image blending

The simplified equation is…

At any boundary pixel position (X,Y)

A background image A

A foreground image B

A mask M

An improved version of B

that blends with A C

C = A

for all (X,Y) belonging to B

Page 10: Gradient image blending

Conditions:

C and A should match at the

boundary.

Transition must be smooth.

A background image A

A foreground image B

A mask M

Correction Factor C

Page 11: Gradient image blending

For the interior pixels,

The Gradient of C must be equal to

the Gradient of B.

Page 12: Gradient image blending

Gradient:

“The sum of the differences between

a pixel and its neighbors.”

Page 13: Gradient image blending

Neighbors

If one of the neighbors is a

boundary pixel, its value is fixed.

Page 14: Gradient image blending

If one of the neighbors is out of

bounds of the selection, it is

excluded.

Page 15: Gradient image blending

This is done for every pixel within C.

Page 16: Gradient image blending

The Equation

N Number of neighboring pixels within the region.

(x,y) Coordinate of pixel.

Omega Non-boundary selection region.

dOmega Boundary selection region.

LHS denotes gradient of C, RHS denotes gradient of B

Page 17: Gradient image blending

The Matrix

Assume there are n pixels in region C.

We need to solve the equation for every

pixel.

We have a System of Linear Equations in n

variables.

Page 18: Gradient image blending

This leads to an n by n matrix.

But n is very large !

Page 19: Gradient image blending

Besides, the matrix is very

sparse, the values are few and

far in between.

Page 20: Gradient image blending

Jacobi’s Method

Px = Q

• P is the matrix of equations defined earlier.

• Q is the result of the equations.

• x is the unknown – the pixels of the region C

Page 21: Gradient image blending

x is initially initialized to 0 (all

values), essentially a black image.

Page 22: Gradient image blending

Error between Q and Px is calculated

and added back to x.

The iterations are repeated until the

error is significantly small.

Page 23: Gradient image blending

GUI Processing 1.5.1

Page 24: Gradient image blending
Page 25: Gradient image blending

More Results

Page 26: Gradient image blending
Page 27: Gradient image blending
Page 28: Gradient image blending

Failures

Page 29: Gradient image blending
Page 30: Gradient image blending