Gradient Domain Blending

Click here to load reader

  • date post

    23-Feb-2016
  • Category

    Documents

  • view

    34
  • download

    1

Embed Size (px)

description

Gradient Domain Blending. James Hays CS 129 Fall 2012. target. source. target. source. It is impossible to faithfully preserve the gradients . Simple 2d example. target, t. source, s. mask. o utput, x. What properties do we want x to have?. Simple 2d example. target, t. source, s. - PowerPoint PPT Presentation

Transcript of Gradient Domain Blending

Slide 1

Not a real composite of one location1Gradient Domain BlendingJames HaysCS 129 Fall 2012sourcetargetIt is impossible to faithfully preserve the gradients sourcetargetSimple 2d examplesource, starget, tmask.2.5.2.2.7.7.7.7.9.9.8.9.8.6.6.6.6.6.2.6.6.8.6.6output, x????????????What properties do we want x to have?Simple 2d examplesource, starget, tmask.8.6.6.6.6.6.2.6.6.8.6.6.2.5.2.2.7.7.7.7.9.9.8.9For unmasked pixels, xi = tiFor masked pixels, we want the gradients at xi to match the gradients at si

But how do we define the gradient? Instead of constraining one or many gradients, in this example we will use the Laplacian.output, x????????????0-10-14-10-10Simple 2d examplesource, starget, tmask.8.6.6.6.6.6.2.6.6.8.6.6Pixel indexing147102581136912output, x????????????x1 = t1x2 = t2x3 = t3x4 = t44x5 x4 x2 x6 x8 = 4s5 s4 s2 s6 s8x6 = t6x7 = t74x8 x7 x5 x9 x11 = 4s8 s7 s5 s9 s11x9 = t9x10 = t10x11 = t11x12 = t12.2.5.2.2.7.7.7.7.9.9.8.90-10-14-10-10LaplacianSimple 2d examplesource, starget, tmask.8.6.6.6.6.6.2.6.6.8.6.6Pixel indexing147102581136912output, x????????????x1 = 0.2x2 = 0.7x3 = 0.9x4 = 0.54x5 x4 x2 x6 x8 = 0.2x6 = 0.9x7 = 0.24x8 x7 x5 x9 x11 = -1.6x9 = 0.8x10 = 0.2x11 = 0.7x12 = 0.9.2.5.2.2.7.7.7.7.9.9.8.90-10-14-10-10LaplacianWe could actually reduce this to two equations, because we only truly have two unknowns (x5 and x8), but the indexing is easier if we do it like this.8Simple 2d examplesource, starget, tmask.8.6.6.6.6.6.2.6.6.8.6.6Pixel indexing147102581136912output, x????????????x1 = 0.2x2 = 0.7x3 = 0.9x4 = 0.54x5 x4 x2 x6 x8 = 0.2x6 = 0.9x7 = 0.24x8 x7 x5 x9 x11 = -1.6x9 = 0.8x10 = 0.2x11 = 0.7x12 = 0.9.2.5.2.2.7.7.7.7.9.9.8.90-10-14-10-10Laplacian4x5 0.5 0.7 0.9 x8 = 0.24x8 0.2 x5 0.8 0.7 = -1.64x5 x8 = 2.34x8 x5 = 0.1x5 = 0.62x8 = 0.18In this simple case, we could solve for everything by hand.We could actually reduce this to two equations, because we only truly have two unknowns (x5 and x8), but the indexing is easier if we do it like this.9*=Simple 2d examplesource, starget, tmask.8.6.6.6.6.6.2.6.6.8.6.6Pixel indexing147102581136912output, x????????????.2.5.2.2.7.7.7.7.9.9.8.90-10-14-10-10Laplacian1111-1-14-1-111-1-14-1-11111.2.7.9.5.2.9.2-1.6.8.2.7.9Axb????????????x = A\bThe same system of equations in matrix formA is mostly an identity matrix.In Matlab, building A (naively) is actually slower than solving for x.We didnt handle the case where the mask touches the border.

10*=Simple 2d examplesource, starget, tmask.8.6.6.6.6.6.2.6.6.8.6.6Pixel indexing147102581136912output, x????????????.2.5.2.2.7.7.7.7.9.9.8.90-10-14-10-10Laplacian1111-1-14-1-111-1-14-1-11111.2.7.9.5.62.9.2.18.8.2.7.9.2.7.9.5.2.9.2-1.6.8.2.7.9Axboutput = reshape(x, 3, 4).2.5.2.2.7.62.18.7.9.9.8.911

sourcetargetmaskno blendinggradient domain blendingWhats the difference?

no blendinggradient domain blending

-=

Whats the difference?

no blendinggradient domain blending-=14

Whats the difference?

no blendinggradient domain blending-=15