140 likes | 318 Views
CS 585 Computational Photography. Nathan Jacobs. Today’s Agenda. Group discussion Assignment 1 S eam carving assignment Recap from last time Gradient Domain/Poisson Image Editing. some terminology. compositing : combining two (or more) images often using an alpha channel
E N D
CS 585 Computational Photography Nathan Jacobs
Today’s Agenda • Group discussion • Assignment 1 • Seam carving assignment • Recap from last time • Gradient Domain/Poisson Image Editing
some terminology • compositing: combining two (or more) images • often using an alpha channel • how do you transition between images? • segmentation: dividing image up into regions of “similar” pixels • matting: soft segmentation to pull an object from the background
Laplacian Pyramids lowpass Images (gaussian) bandpass Images (laplacian)
laplacian level 4 laplacian level 2 laplacian level 0 left pyramid right pyramid blended pyramid
LaplacianPyramid Blending • We decomposed our image into a set of Difference-of-Gaussian images and a low-res image • Now lets look at 1storder derivatives (gradients)
Gradient Domain • Let us now look at 1st order derivatives (gradients): • No need for low-res image • captures everything (up to a constant) • Idea: • Differentiate • Blend • Reintegrate
James McCann and Nancy S. Pollard. Real-time Gradient-domain Painting, ACM Transactions on Graphics (SIGGRAPH 2008),
code for 1D gradient blending • mask = double(im1 > 15); • im1 = 1:30; im2 = 5*sin(linspace(0,15,30)); • im1g = gradient(im1); • im2g = gradient(im2); • imBlend = mask.*im1 + (1-mask).*im2; • imBlendGradient = mask.*im1g + (1-mask).*im2g; • imBlendGradient(1) = imBlend(1); % fix one value (should really fix both ends) • imBlendGradient = cumsum(imBlendGradient); % reintegrate • figure(1); • subplot(2,2,1), plot(im1), title('signal one') • subplot(2,2,2), plot(im2), title('signal two') • subplot(2,2,3), plot(imBlend), title('direct blending') • subplot(2,2,4), plot(imBlendGradient), title('gradient blending')
Gradient Domain Blending (2D) • Trickier in 2D: • Take partial derivatives dx and dy (the gradient field) • Fiddle around with them (smooth, blend, feather, etc) • Reintegrate • But now integral(dx) might not equal integral(dy) • Find the most agreeable solution • Equivalent to solving Poisson equation • Can use FFT, deconvolution, multigrid solvers, etc. • Show linear constraints on board…
Perez et al, 2003 • Limitations: • Can’t do contrast reversal (gray on black -> gray on white) • Colored backgrounds “bleed through” • Images need to be very well aligned editing
next time • Graph Cut Based Methods • read: • Lazy Snapping, Yin Li, Jian Sun, Chi-Keung Tang, and Heung-YeungShum. April 2004 • GrabCut (Rother et al. ’04)