• 沒有找到結果。

Intensity Gradient Manipulation

N/A
N/A
Protected

Academic year: 2022

Share "Intensity Gradient Manipulation"

Copied!
60
0
0

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

全文

(1)

Gradient domain operations

Digital Visual Effects Yung-Yu Chuang

with slides by Fredo Durand, Ramesh Raskar, Amit Agrawal

(2)

Gradient domain operators

(3)

Gradient Domain Manipulations

Estimation of Gradients Manipulation of

Gradients

Non-Integrable Gradient Fields

Reconstruction from

Gradients

Images/Videos/

Meshes/Surfaces Images/Videos/

Meshes/Surfaces

(4)

Grad X

Grad Y

Integration2D

Image Intensity Gradients in 2D

Solve

Poisson Equation, 2D linear system

(5)

Grad X

Grad Y

New Grad X

New Grad Y

Integration2D

Intensity Gradient Manipulation

Gradient Processing

A Common Pipeline

1. Gradient manipulation

2. Reconstruction from gradients

(6)

Example Applications

Removing Glass Reflections

Seamless Image Stitching

(7)

Image Editing

Changing Local Illumination

(8)

High Dynamic Range Compression

Original PhotoshopGrey Color2Gray

Color to Gray Conversion

(9)

Edge Suppression under Significant Illumination Variations

Fusion of day and night images

(10)

Grad X

Grad Y

New Grad X

New Grad Y

Integration2D

Intensity Gradient Manipulation

Gradient Processing

A Common Pipeline

(11)

Intensity Gradient in 1D

I(x) 1

105

G(x) 1

105

Intensity Gradient

Gradient at x,

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

Forward Difference

(12)

Reconstruction from Gradients

I(x) 1

105 Intensity

G(x) 1

105 Gradient

? ?

For n intensity values, about n gradients

(13)

Reconstruction from Gradients

I(x) 1

105 Intensity

G(x) 1

105 Gradient

1D Integration

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

?

(14)

1D case with constraints

Seamlessly paste onto

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

(15)

Discrete 1D example: minimization

• Copy to

• Min ((f2-f1)-1)2

• Min ((f3-f2)-(-1))2

• Min ((f4-f3)-2)2

• Min ((f5-f4)-(-1))2

• Min ((f6-f5)-(-1))2

0 1 2 3 4 5 6

0

1 2 3 4 5 6 7 -1 -1 -1

+2 +1

0 1 2 3 4 5 6

0 1 2 3 4 5 6 7

? ? ? ?

With

f

1

=6

f

6

=1

(16)

1D example: minimization

• Copy to

• Min ((f2-6)-1)2 ==> f22+49-14f2

• Min ((f3-f2)-(-1))2 ==> f32+f22+1-2f3f2 +2f3-2f2

• Min ((f4-f3)-2)2 ==> f42+f32+4-2f3f4 -4f4+4f3

• Min ((f5-f4)-(-1))2 ==> f52+f42+1-2f5f4 +2f5-2f4

• Min ((1-f5)-(-1))2 ==> f52+4-4f5

0 1 2 3 4 5 6

0

1 2 3 4 5 6 7 -1 -1 -1

+2 +1

0 1 2 3 4 5 6

0 1 2 3 4 5 6 7

? ? ? ?

(17)

1D example: big quadratic

• Copy to

• Min (f22+49-14f2

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

Denote it Q

0 1 2 3 4 5 6

0

1 2 3 4 5 6 7 -1 -1 -1

+2 +1

0 1 2 3 4 5 6

0 1 2 3 4 5 6 7

? ? ? ?

(18)

1D example: derivatives

• Copy to

0 1 2 3 4 5 6

0

1 2 3 4 5 6 7 -1 -1 -1

+2 +1

0 1 2 3 4 5 6

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 + f52+4-4f5)

Denote it Q

(19)

1D example: set derivatives to zero

• Copy to

0 1 2 3 4 5 6

0

1 2 3 4 5 6 7 -1 -1 -1

+2 +1

0 1 2 3 4 5 6

0 1 2 3 4 5 6 7

? ? ? ?

==>

(20)

1D example

• Copy to

0 1

2 3 4 5 6

0 1 2 3 4 5 6 7 -1

-1 -1

+2 +1

0 1 2 3 4 5 6

0

1 2 3 4 5 6 7

(21)

1D example: remarks

• Copy to

• Matrix is sparse

• Matrix is symmetric

• Everything is a multiple of 2

– because square and derivative of square

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

• Matrix is independent of gradient field. Only RHS is

• Matrix is a second derivative

0 1 2 3 4 5 6

0

1 2 3 4 5 6 7 -1 -1 -1

+2 +1

0 1 2 3 4 5 6

0

1 2 3 4 5 6 7

(22)

2D example: images

• Images as scalar fields

– R2 -> R

(23)

Gradients

• Vector field (gradient field)

– Derivative of a scalar field

• Direction

– Maximum rate of change of scalar field

• Magnitude

– Rate of change

(24)

Example

Image

I(x,y) Ix Iy

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) G(x,y) = (Gx , Gy)

(25)

Ix

Iy

Integration2D

Reconstruction from Gradients

Sanity Check:

Recovering Original Image

Solve

Poisson Equation 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 !

Gx

Gy

Integration2D

(27)

2D Integration is non-trivial

df/dx f(x)

f(x,y)

x y

Reconstruction depends on chosen path

(28)

Reconstruction from Gradient Field G

• Look for image

I

with gradient closest to

G

in the least squares sense.

• I

minimizes the integral:

( , )

2 2

÷÷

2

ø çç ö

è

æ -

¶ + ¶

÷ ø ç ö

è

æ -

= ¶ -

Ñ

=

Ñ

x

G

y

y G I

x G I

I G

I F

( )

òò F Ñ I , G dxdy

y G x

G y

I x

I

x y

¶ + ¶

= ¶

¶ + ¶

2 2 2

2 Poisson

equation

(29)

Solve

y G x

G y

I x

I

x y

¶ + ¶

= ¶

¶ + ¶

2 2 2

2

) 1 ,

( )

, ( )

, 1 (

) ,

(x y - G x - y + G x y - G x y -

Gx x y 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 (

. .

y x u

y x

I y x I

y x I

y x I

y x

I

x,y

[. 1 . . . 1 -4 1 . . . 1 .] H

x,y-1 H

A x b

x-1,y H

W

) , ( )

, 1 (

) , 1 (

) 1 ,

( )

1 ,

( )

, (

4I x y + I x y + + I x y - + I x+ y + I x - y = u x y -

(31)

Sparse Linear system

úú úú úú úú ú

û ù

êê êê êê êê ê

ë é

- -

- -

- -

-

1 4

1 1

1 4

1 1

1 1

4 1

1

1 1

4 1

1

1 1

4 1

1

1 1

4 1

1 1

4 1

A matrix

(32)

Solving Linear System

• Image size N*N

• Size of A ~ N2 by N2

• Impractical to form and store A

• Direct Solvers

• Basis Functions

• Multigrid

• Conjugate Gradients

(33)

Grad X

Grad Y

New Grad X

New Grad Y

Integration2D

Intensity Gradient Manipulation

Gradient Processing

A Common Pipeline

(34)

Gradient Domain Manipulations: Overview

(A) Per pixel

(B) Corresponding gradients in two images

(C) Corresponding gradients in multiple images (D) Combining gradients along seams

(35)

A. Per Pixel Manipulations

• Non-linear operations

– HDR compression, local illumination change

• Set to zero

– Shadow removal, intrinsic images, texture de-emphasis

(36)

High Dynamic Range Imaging

Images from Raanan Fattal

(37)

Gradient Domain Compression

HDR

Image L Log L

Gradient Attenuation Function G

Multiply Integration2D

Gradients Lx,Ly

(38)

Illumination Invariant Image

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

Original Image Illumination invariant image

• Assumptions

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

(39)

Shadow Removal Using Illumination Invariant Image

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

Original Image

Illumination invariant image

Shadow Edge Locations

Edge Map

Integrate

(40)

Gradient Domain Manipulations: Overview

(A) Per pixel

(B) Corresponding gradients in two images

(C) Corresponding gradients in multiple images (D) Combining gradients along seams

(41)

Photography Artifacts: Flash Hotspot

Ambient Flash

Flash Hotspot

(42)

Underexposed Reflections

Ambient Flash

Reflections due to Flash

(43)

Ambient Flash

Self-Reflections and Flash Hotspot

Hands Face

Tripod

(44)

Result Ambient

Flash

Reflection Layer

Hands Face

Tripod

(45)

Intensity Gradient Vectors in Flash and Ambient Images

Same gradient

vector direction Flash Gradient Vector

Ambient Gradient Vector

Ambient Flash

No reflections

(46)

Reflection Ambient Gradient Vector

Different gradient vector directions

With reflections

Ambient Flash

Flash Gradient Vector

(47)

Residual Gradient

Vector

Intensity Gradient Vector Projection

Result Gradient Vector

Result Residual

Reflection Ambient Gradient Vector

Flash Gradient Vector

Ambient Flash

(48)

Flash

Projection = Result

Residual = Reflection Layer Ambient

(49)

Flash

Ambient

Checkerboard outside glass window Reflections on

glass window

(50)

removed

2D Integration

Flash

Ambient

X

Y X

Y

Forward Differences

Intensity Gradient

Vector Projection

Result X

Result Y

Result

2D Integration Gradient

Difference

Residual X

Residual Y

Reflection Layer Result

Checkerboard

Checkerboard

(51)

Poisson Image Editing

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

– Seamless cloning: loose selection but no seams?

(52)

Conceal

Copy Background gradients (user strokes)

(53)

Compose

Target Image Source Images

(54)

Transparent Cloning

Largest variation from source and destination at each point

(55)

Gradient Domain Manipulations: Overview

(A) Per pixel

(B) Corresponding gradients in two images

(C) Corresponding gradients in multiple images (D) Combining gradients along seams

(56)

Intrinsic images

• I = L * R

• L = illumination image

• R = reflectance image

(57)

Intrinsic images

– Use multiple images under different illumination – Assumption

• Illumination image gradients = Laplacian PDF

• Under Laplacian PDF, Median = ML estimator

– At each pixel, take Median of gradients across images

– Integrate to remove shadows

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

(58)

Result = Illumination Image * (Label in Intrinsic Image) Shadow free

Intrinsic Image

(59)

Gradient Domain Manipulations: Overview

(A) Per pixel

(B) Corresponding gradients in two images

(C) Corresponding gradients in multiple images (D) Combining gradients along seams

(60)

Seamless Image Stitching

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

參考文獻

相關文件

We refer to “total training time of method x” as the whole LIBSVM training time (where method x is used for reconstructing gradients), and “reconstruction time of method x” as

Salas, Hille, Etgen Calculus: One and Several Variables Copyright 2007 © John Wiley & Sons, Inc.. All

4 samples per pixel (jittered).. Stratified sampling Stratified sampling. 1 camera sample and 16 shadow samples

Metropolis light transport (average 250 mutations per pixel, same computation time as

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

[r]

Light rays start from pixels B(s, t) in the background image, interact with the foreground object and finally reach pixel C(x, y) in the recorded image plane. The goal of environment

1 camera sample and 16 shadow samples per pixel. 16 camera samples and each with 1 shadow sample