Gradient image blending

Preview:

Citation preview

Gradient Image BlendingCS 7490 | Advanced Image Synthesis | Project

Prashanth Palanthandalam

Based on

Poisson Image Editing by Perez et. al.

SIGGRAPH 2003

Example

The Challenge

To seamlessly blend a pixel into

another image, it’s neighboring

pixel values must also be known.

We need to consider

Image Gradients

which quantitatively indicate

how pixels change with respect

to their neighbors.

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.

Mathematically, we have

A background image A

A foreground image B

A mask M

An improvised version of B Cwhich blends with A .

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

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

For the interior pixels,

The Gradient of C must be equal to

the Gradient of B.

Gradient:

“The sum of the differences between

a pixel and its neighbors.”

Neighbors

If one of the neighbors is a

boundary pixel, its value is fixed.

If one of the neighbors is out of

bounds of the selection, it is

excluded.

This is done for every pixel within C.

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

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.

This leads to an n by n matrix.

But n is very large !

Besides, the matrix is very

sparse, the values are few and

far in between.

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

x is initially initialized to 0 (all

values), essentially a black image.

Error between Q and Px is calculated

and added back to x.

The iterations are repeated until the

error is significantly small.

GUI Processing 1.5.1

More Results

Failures

Recommended