• 沒有找到結果。

Image Intensity Gradients in 2D g y

N/A
N/A
Protected

Academic year: 2022

Share "Image Intensity Gradients in 2D g y"

Copied!
96
0
0

加載中.... (立即查看全文)

全文

(1)

Gradient domain operations

Digital Visual Effects g Yung-Yu Chuang

with slides by Fredo Durand, Ramesh Raskar, Amit Agrawal

(2)

Gradient Domain Manipulations

Images/Videos/

Meshes/Surfaces

Estimation Manipulation of

Meshes/Surfaces

of Gradients p

Gradients

Non-Integrable Gradient Fields

Reconstruction from

Gradients

Images/Videos/

Meshes/Surfaces

(3)

Image Intensity Gradients in 2D g y

Grad X

Integration2D

Grad Y

Solve

Poisson Equation, 2D linear system 2D linear system

(4)

Intensity Gradient Manipulation y p

A Common Pipeline

Grad X New Grad X

Integration2D Gradient

Processing

Grad Y New Grad Y

1. Gradient manipulation

2 Reconstruction from gradients 2. Reconstruction from gradients

(5)

Example Applications

Removing Glass Reflections

Seamless Image Stitching

(6)

Image Editing

Changing Local Illumination Changing Local Illumination

(7)

Original PhotoshopGrey Color2Gray

Color to Gray Conversiony

High Dynamic Range Compression

(8)

Ed S i d Si ifi t Ill i ti V i ti Edge Suppression under Significant Illumination Variations

Fusion of day and night images

(9)

Intensity Gradient Manipulation y p

A Common Pipeline

Grad X New Grad X

Integration2D Gradient

Processing

Grad Y New Grad Y

(10)

Intensity Gradient in 1D

Intensity Gradient

105 105

y

I(x) 1

G(x) 1

Gradient at x,

G(x) = I(x+1)- I(x) G(x) I(x+1) I(x)

Forward Difference

(11)

Reconstruction from Gradients

Intensity Gradient

105

y

105

?

? ? ?

I(x) 1

G(x) 1

For n intensity values, about n gradients y , g

(12)

Reconstruction from Gradients

Intensity Gradient

105

y

105

?

?

I(x) 1

G(x) 1

1D Integration

I(x) = I(x 1) + G(x) I(x) = I(x-1) + G(x)

Cumulative sum

(13)

1D case with constraints

Seamlessly paste onto

Seamlessly paste onto

Just add a linear function so that the boundary condition is respected

(14)

Discrete 1D example: minimization

• Copy to

5 6

1 -1 1

+2

+1 5

6

2 3

4 +1 -1 -1

2 3 4

0 1

0 1 2 3 4 5 6 7 0

1 2

0

1 2 3 4 5 6 7

? ? ? ?

Min ((f f ) 1)

2

• Min ((f

2

-f

1

)-1)

2

• Min ((f

3

-f

2

)-(-1))

2

• Min ((f

4

-f

3

)-2)

2

With

• Min ((f

5

-f

4

)-(-1))

2

With f

1

=6

((

5 4

) ( ))

• Min ((f

6

-f

5

)-(-1))

2

f

6

=1

(15)

1D example: minimization

• Copy to

5 6

1 -1 1

+2

+1 5

6

2 3

4 +1 -1 -1

2 3 4

0 1

0 1 2 3 4 5 6 7 0

1 2

0

1 2 3 4 5 6 7

? ? ? ?

• Min ((f

2

-6)-1)

2

==> f

22

+49-14f

2

Mi ((f f ) ( 1))

2

f

2

f

2

1 2f f 2f 2f

• Min ((f

3

-f

2

)-(-1))

2

==> f

32

+f

22

+1-2f

3

f

2

+2f

3

-2f

2

• Min ((f

4

-f

3

)-2)

2

==> f

42

+f

32

+4-2f

3

f

4

-4f

4

+4f

3

• Min ((f

5

-f

4

)-(-1))

2

==> f

52

+f

42

+1-2f

5

f

4

+2f

5

-2f

4

• Min ((1-f

5

)-(-1))

2

==> f

52

+4-4f

5

• Min ((1 f

5

) ( 1)) > f

5

+4 4f

5

(16)

1D example: big quadratic

• Copy to

5 6

1 -1 1

+2

+1 5

6

2 3

4 +1 -1 -1

2 3 4

0 1

0 1 2 3 4 5 6 7 0

1 2

0

1 2 3 4 5 6 7

? ? ? ?

• Min (f22+49-14f2

+ f 2+f 2+1 2f f +2f 2f + f32+f22+1-2f3f2 +2f3-2f2 + f42+f32+4-2f3f4 -4f4+4f3 + f 2+f 2+1 2f f +2f 2f + f52+f42+1-2f5f4 +2f5-2f4 + f52+4-4f5)

Denote it Q Denote it Q

(17)

1D example: derivatives

• Copy to

5 6

1 -1 1

+2

+1 5

6

2 3

4 +1 -1 -1

2 3 4

0 1

0 1 2 3 4 5 6 7 0

1 2

0

1 2 3 4 5 6 7

? ? ? ?

Min (f22+49-14f2

+ f32+f22+1-2f3f2 +2f3-2f2 + f42+f32+4-2f3f4 -4f4+4f3 + f52+f42+1-2f5f4 +2f5-2f4 + f 2+4 4f )

+ f52+4-4f5) Denote it Q

(18)

1D example: set derivatives to zero

• Copy to

5 6

1 -1 1

+2

+1 5

6

2 3

4 +1 -1 -1

2 3 4

0 1

0 1 2 3 4 5 6 7 0

1 2

0

1 2 3 4 5 6 7

? ? ? ?

==>

(19)

1D example

• Copy to

5 6

1 -1 1

+2

+1 5

6

3

4 +1 -1 -1

3 4

1 2

1 2

0 0

1 2 3 4 5 6 7 0 0 1 2 3 4 5 6 7

(20)

1D example: remarks

• Copy to

2 3 4 5 6

-1 -1 -1

+2 +1

2 3 4 5 6

0 1 2

0

1 2 3 4 5 6 7 0

1 2

0 1 2 3 4 5 6 7

Matrix is sparse

• Matrix is sparse

• Matrix is symmetric

E thi i lti l f 2

• Everything is a multiple of 2

– because square and derivative of square

• Matrix is a convolution (kernel 2 4 2)

• Matrix is a convolution (kernel -2 4 -2)

• Matrix is independent of gradient field. Only RHS is Matrix is a second derivative

• Matrix is a second derivative

(21)

2D example: images

• Images as scalar fields

– R2 -> R

(22)

Gradients

• Vector field (gradient field)

D i ti f l fi ld – Derivative of a scalar field

• Direction

– Maximum rate of change of scalar field

• Magnitude

– Rate of changeg

(23)

Gradient Field

• Components of gradient

– Partial derivatives of Partial derivatives of scalar field

I I

 , }

{ y

I x

I I

  ) 

, ( y x

I y

) , ,

( x y t

I { , , }

t I y

I x

I I

  ) 

, ,

( yxyt

(24)

Example

Image

I(x y)

I

x

I

y

I(x,y)

Gradient at x y as Forward Differences Gradient at x,y as Forward Differences

Gx(x,y) = I(x+1 , y)- I(x,y) Gy(x,y) = I(x , y+1)- I(x,y) Gy(x,y) I(x , y 1) I(x,y) G(x,y) = (Gx , Gy)

(25)

Reconstruction from Gradients

Sanity Check:

Recovering Original Image

Ix

Recovering Original Image

2D Iy

Integration2D

Solve

Poisson Equation 2D linear system 2D linear system

Same

(26)

Reconstruction from Gradients

Given G(x,y) = (Gx , Gy)

How to compute I(x,y) for the image ? For n 2 image pixels 2 n 2 gradients ! For n 2 image pixels, 2 n 2 gradients !

Gxx

Gy

Integration2D Gy

(27)

2D Integration is non-trivial

df/dx f(x)

df/dx f(x)

f(x,y) y

xx

Reconstruction depends on chosen path

(28)

Reconstruction from Gradient Field G

• Look for image I with gradient closest to G in th l t

the least squares sense.

• I minimizes the integral: g  F I , Gdxdy

2 2

 

 

 , y

,

2 2



2

 

 

 

 

 

 

 

x

G

y

y G I

x G I

I G

I

F   x    y

G G I

I   

2 2

Poisson

y G x

G y

I x

I

x y

 

 

 

2 2

Poisson

equation

(29)

Solve I I G

x

G

y

2 2

Solve

y x

y

x  

 

2 2

) 1 ,

( )

, ( )

, 1 (

) ,

( x yG xyG x yG x yG

xx

( , y )

xx

( , y )

yy

( , y )

yy

( , y )

) , ( 4 )

1 ,

( )

1 ,

( )

, 1 (

) , 1

( x y I x y I x y I x y I x y

I        

 

 

 

 

 

 

 

 

 

 

 

 

 

.. 1 … 1 -4 1 … 1 ..

I

 

 

 

 

 

 

     

(30)

Linear System

) , ( )

, 1 (

) , 1 (

) 1 ,

( )

1 ,

( )

, (

4I x y I x y I x y I x y I x y u x y

. .

. . . .

. .

) , 1 (

. y x

I

H x,y-1

H

) , (

.

) , (

) 1 , (

.

y x u y

x I

y x I

x,y

. 1 . . . 1 4 1 . . . 1 .

x-1,y H

. . .

. .

) 1 , (x y I

H W

. . . .

. .

) , 1 (

. y x

I

W







 . .

A x b

(31)

Sparse Linear system

1 1

4 1

1 1

4 1

1 1

4 1

1

1 1

4 1

1

1 4

1 1

1 1

4 1

1



 1 1 4 1

A matrix

A matrix

(32)

Solving Linear System

• Image size N*N

• Size of A ~ N

2

by N

2

• Impractical to form and store A

• Direct Solvers B i F ti

• Basis Functions

• Multigrid

• Conjugate Gradients

(33)

Approximate Solution for Large Scale Problems

Problems

• Resolution is increasing in digital cameras

• Stitching, Alignment requires solving large

linear system

(34)

Scalability problem

10 X 10 MP X 50% overlap =

50 Megapixel Panorama

A x = b

(35)

Scalability problem

A x = b

A x b

50 million element vectors!

(36)

Approximate Solution

• Reduce size of linear system H dl hi h l i i

• Handle high resolution images

• Part of Photoshop CS3

• Part of Photoshop CS3

Aseem Agarwala. "Efficient gradient-domain compositing using quadtrees," ACM Transactions on Graphics (Proceedings of SIGGRAPH 2007)

(37)

The key insight

Desired solution x

_

Initial

Solution x

0

=

Solution x

0

Difference x

δ

x

δ

(38)
(39)

Quadtree decomposition

(40)

• Maximally subdivide quadtree along seams

• Variables placed at node corners

R i d d

• Restricted quadtree

• Bi-linear interpolation reconstructs full solution Square nodes

• Square nodes

(41)

Reduced space

y

m variables

x

n variables m variables

n variables

<<

m << n

(42)

Reduced space

y

m variables

x

n variables m variables

n variables

S

x = Sy

(43)

x = Sy

x = Sy

(44)

x = Sy

x = Sy

(45)

x = Sy

x = Sy

(46)

x = Sy

x = Sy

(47)

Performance

227 96

13 Plane

1044 227

362 24

St. Emilion

1252 1044

435 16

Beynac

1790 1252

620 27

Rainier

1790

1 10 100 1000 10000

Memory (MB)

Quadtree [Agarwala 07]

Hierarchical basis preconditioning [Szeliski 90]p g [ ]

Locally-adapted hierarchical basis preconditioning [Szeliski 06]

(48)

Cut-and-paste

(49)

Cut-and-paste

(50)

Intensity Gradient Manipulation y p

A Common Pipeline

Grad X New Grad X

Integration2D Gradient

Processing

Grad Y New Grad Y

(51)

Gradient Domain Manipulations: Overview

(A) Per pixel

(B) Corresponding gradients in two images

( ) p g g g

(C) Corresponding gradients in multiple images

(C) Corresponding gradients in multiple images

(D) Combining gradients along seams

(52)

Gradient Domain Manipulations: Overview

(A) Per pixel

– Non-linear operations (HDR compression, local illumination change) – Set to zero (shadow removal, intrinsic images, texture de-emphasis)

Poisson Matting – Poisson Matting

(B) Corresponding gradients in two images (B) Corresponding gradients in two images – Vector operations (gradient projection)

• Combining flash/no-flash images, Reflection removalCombining flash/no flash images, Reflection removal

– Projection Tensors

• Reflection removal, Shadow removal

– Max operator

• Day/Night fusion, Visible/IR fusion, Extending DoF

– Binary, choose from first or second, copying

• Image editing, seamless cloning

(53)

Gradient Domain Manipulations

(C) Corresponding gradients in multiple images – Median operatorp

• Specularity reduction

• Intrinsic images

– Max operation

• Extended DOF

(D) Combining gradients along seams – Weighted averagingg g g

– Optimal seam using graph cut

• Image stitching, Mosaics, Panoramas, Image fusion

• A usual pipeline: Graph cut to find seams + gradient domain fusion

• A usual pipeline: Graph cut to find seams + gradient domain fusion

(54)

A. Per Pixel Manipulations

• Non-linear operations

– HDR compression, local illumination changep , g

• Set to zero

– Shadow removal intrinsic images texture de-emphasisShadow removal, intrinsic images, texture de emphasis

P i M tti

• Poisson Matting

(55)

High Dynamic Range Imaging

Images from Raanan Fattal

(56)

Gradient Domain Compression

Gradients L L

HDR

Lx,Ly

Image L Log L Multiply Integration2D

Gradient Attenuation Gradient Attenuation Function G

(57)

Local Illumination Change

Original Image: f

Original gradient field: g g

  f f

*

Modified gradient field: v

Perez et al. Poisson Image editing, SIGGRAPH 2003

(58)

Illumination Invariant Image

Original Image Illumination invariant image

• Assumptions

– Sensor response = delta functions R G B in wavelength spectrumSensor response = delta functions R, G, B in wavelength spectrum – Illumination restricted to Outdoor Illumination

G. D. Finlayson, S.D. Hordley & M.S. Drew, Removing Shadows From Images, ECCV 2002

(59)

Shadow Removal Using Illumination Invariant Image

Invariant Image

Original Image Edge Map

Integrate

Illumination invariant image

Shadow Edge Locations

G. D. Finlayson, S.D. Hordley & M.S. Drew, Removing Shadows From Images, ECCV 2002

Illumination invariant image

(60)

Illumination invariant image g

Original Image

Invariant Image

g Image

Detected Sh d

Detected Shadow

Edges

Shadow Removed

G. D. Finlayson, S.D. Hordley & M.S. Drew, Removing Shadows From Images, ECCV 2002

(61)

Intrinsic Image

• Photo = Illumination Image * Intrinsic Image

• Retinex [Land & McCann 1971 Horn 1974]

• Retinex [Land & McCann 1971, Horn 1974]

– Illumination is smoothly varying

– Reflectance, piece-wise constant, has strong edges

– Keep strong image gradients, integrate to obtain reflectance

low-frequency high-frequency

attenuate more g q y

attenuate less

(62)

Poisson Matting

Background B

Alpha

Trimap: User specified

Foreground F Trimap: User specified

Jian Sun, Jiaya Jia, Chi-Keung Tang, Heung-Yeung Shum, Poisson Matting, SIGGRAPH 2004

(63)

Poisson Matting

Approximate: Assume F and B are smooth Approximate: Assume F and B are smooth

Poisson Equation

F and B in tri map using Poisson Equation

F and B in tri-map using nearest pixels

(64)

Poisson Matting

• Steps

– Approximate F and B in trimap

– Solve for ,

– Refine F and B using

– Iterate

(65)

Gradient Domain Manipulations: Overview

(A) Per pixel

(B) Corresponding gradients in two images

( ) p g g g

(C) Corresponding gradients in multiple images

(C) Corresponding gradients in multiple images

(D) Combining gradients along seams

(66)

Photography Artifacts: Flash Hotspot

Ambient Flash

Flash Flash Hotspot

(67)

Underexposed Reflections

Reflections due to Flash Reflections due to Flash

Underexposed Reflections

Ambient Flash

(68)

Ambient Flash

Self-Reflections and Flash Hotspot

Face

Hands

Tripod

(69)

Result

Ambient Reflection LayerReflection Layer

Fl h

Flash Face

Hands

Tripod

(70)

Intensity Gradient Vectors in Flash and Ambient Images

Same gradient

vector direction Flash Gradient Vector

Ambient Gradient Vector

Ambient Flash

No reflections

(71)

Reflection Ambient Gradient Reflection Ambient Gradient

Vector

Different gradient d

Flash Gradient Vector

vector directions

Ambient Flash

With reflections

(72)

Intensity Gradient Vector Projection

Reflection Ambient Gradient Residual

Gradient

Reflection Ambient Gradient Vector

Flash Gradient Vector Gradient

Vector

Result Gradient Vector

Result Residual

Ambient Flash

(73)

Flash

Projection = Result

Residual = Reflection Layer

Ambient Flash

Ambient

(74)

Flash

Ambient

Checkerboard outside glass window Reflections on

glass window

(75)

X

Forward Differences

Gradient Difference

Residual X

Checkerboard

Difference

Residual Y

Checkerboard

removed

Flash

Y

Result X

Residual Y

2D

Flash

Intensity Gradient

2D Integration

Integration Vector Projection

Result Y

Result X

Result

Reflection Layer Result

Y

Layer

Ambient

(76)

Image Fusion for

Context Enhancement Context Enhancement

and Video Surrealism

Adrian Ilie Adrian Ilie Ramesh Raskar

Ramesh Raskar Adrian IlieAdrian Ilie Jingyi YuJingyi Yu

UNC Chapel Hill UNC Chapel Hill

Ramesh Raskar Ramesh Raskar

Mitsubishi Electric Mitsubishi Electric

Research Labs Research Labs

Jingyi Yu Jingyi Yu

MIT MIT Research Labs,

Research Labs, (MERL) (MERL)

(77)
(78)

Dark Bldgs

Reflections on bldgs

Unknown shapes

(79)

Background is captured from day-time scene using the same fixed camera Night Image

Context Enhanced Image

Day Image

Context Enhanced Image

(80)

Mask is automatically computed from Mask is automatically computed from

scene contrast

(81)

But, Simple Pixel Blending Creates Ugly Artifacts

Ugly Artifacts

(82)

Pixel Blending

(83)

Pixel Blending

solution:

Integration of g blended Gradients

(84)

Nighttime image

Nighttime image Gradient fieldGradient field Nighttime image

Nighttime image Gradient fieldGradient field G1x GY1 I1

Mixed gradient field

Importance Importance

image W image W

g

Gx GY

I2

result

G2xx GY2

Daytime image

Daytime image Gradient fieldGradient field Final

y g

y g

(85)

Poisson Image Editing Poisson Image Editing

– Precise selection: tedious and unsatisfactory Alpha Matting: powerful but involved

– Precise selection: tedious and unsatisfactory Alpha Matting: powerful but involved

– Alpha-Matting: powerful but involved

– Seamless cloning: loose selection but no seams?

– Alpha-Matting: powerful but involved

– Seamless cloning: loose selection but no seams?

(86)

Conceal Conceal

Copy Background gradients (user strokes)

(87)

Compose Compose p p

Target Image Source Images

(88)

Transparent Cloning Transparent Cloning

Largest variation from source and destination at each Largest variation from source and destination at each

point

(89)

Gradient Domain Manipulations: Overview

(A) Per pixel

(B) Corresponding gradients in two images

( ) p g g g

(C) Corresponding gradients in multiple images

(C) Corresponding gradients in multiple images

(D) Combining gradients along seams

(90)

Intrinsic images

• I = L * R

L ill i i i

• L = illumination image

• R = reflectance image

(91)

Intrinsic images

U lti l i d diff t ill i ti – Use multiple images under different illumination – Assumption

Ill i ti i g g di t L l i PDF

• Illumination image gradients = Laplacian PDF

• Under Laplacian PDF, Median = ML estimator

At each pixel take Median of gradients across – At each pixel, take Median of gradients across

images

– Integrate to remove shadowsIntegrate to remove shadows

Yair Weiss, “Deriving intrinsic images from image sequences”, ICCV 2001

(92)

Shadow free Intrinsic Image

Result = Illumination Image * (Label in Intrinsic Image)

(93)

Specularity Reduction in Active Illumination

Illumination

Point Specularity

Line Specularity Area Specularity

Multiple images with same viewpoint, varying illumination How do we remove highlights?

(94)

Specularity Reduced Image

Image

(95)

Gradient Domain Manipulations: Overview

(A) Per pixel

(B) Corresponding gradients in two images

( ) p g g g

(C) Corresponding gradients in multiple images

(C) Corresponding gradients in multiple images

(D) Combining gradients along seams

(96)

Seamless Image Stitching

Anat Levin, Assaf Zomet, Shmuel Peleg and Yair Weiss, “Seamless Image Stitching in the Gradient Domain”, ECCV 2004

參考文獻

相關文件

T transforms S into a region R in the xy-plane called the image of S, consisting of the images of all points in S.... So we begin by finding the images of the sides

– Change Window Type to Video Scene Editor – Select Add → Images and select all images – Drag the strip to the “1st Frame” in Layer

Example: Image produced by a spherical mirror... 14.5 Spherical

The principal chiral model has two conserved currents corresponding to the G × G symmetry of the action.. These currents are

Quantum Hall Effect in Black Phosphorus 2DEG.. Likai Li

11.4 Differentials and the Chain Rules 11.5 Directional Derivatives and Gradients 11.6 Tangent Planes and Normal Lines 11.7 Extrema of Functions of Two Variables 11.8

• Similar to Façade, use a generic face model and view-dependent texture mapping..

Vetter, Reanimating Faces in Images and Video, EUROGRAPHICS 2003. Seidel, Exchanging Faces in Images,