Download presentation
Presentation is loading. Please wait.
Published byBertha Bradford Modified over 8 years ago
1
Advanced Topics in Computer Graphics Exercise 1 Poisson Image Editing Due date: 17.05.05 Presentation by: Tommer Leyvand
2
General Description The purpose of this exercise is to understand and implement a Poisson seamless cloning image editing tool. Part 1: Smooth image completion Part 2: Poisson seamless cloning
3
Input Images source image target image
4
Simple Cloning Result
5
Poisson Seamless Cloning Result
6
Some More Results source images target image
7
Some More Results source images simple cloning
8
Some More Results source images Poisson seamless cloning
9
Part 1 Smooth Completion
10
Image as a 2D Function
11
Smooth Image Completion What if there is a missing area ? f* – the known image Scalar 2D function from (x,y) to grayscale value. f - the image in the unknown area Ω – the unknown area (domain of f) Will complete the area as smoothly as possible.
12
Smooth Image Completion (Cont.) Finding the minimum: Euler-Lagrange Discrete Aprx:
13
Discrete Derivate in 1D Given a discrete function f(x i )=f i x f f(x i ) f(x j )
14
Smooth Image Completion (Solving) Each f x,y is an unknown variable x i, total of N variables (covering the unknown pixels) Reduces to the sparse algebraic system: N x N = 00b1b2000b3000b1b2000b30 1 1 -4 1 1 Known values of f() contribute to the left side x i-w +x i-1 -4x i +x i+1 =-f(x,y+1) f x,y-1 +f x-1,y -4f x,y +f x+1,y +f x,y+1 =0 => x i-w +x i-1 -4x i +x i+1 +x i+w =0 x1x2…xNx1x2…xN
15
Program Usage The program generates one output image Ex1 –complete Ex1 –complete R G B <output> Where R,G,B are the RGB values [0..255] of the unknown color (usually best as black 0,0,0) Example: Example: Ex1 –complete in1.bmp 0 0 0 out1.bmp Ex1 –complete in1.bmp 0 0 0 out1.bmp
16
Wow result input result ground truth
17
Part 2 Poisson Cloning
18
Poisson Cloning: “Guiding” the completion We can guide the completion from part1 to fill the hole using gradients from another source image Reverse: Seek a function f whose gradients are closest to the gradients of the source image
19
Poisson Cloning (forward difference) (backward difference)
20
Poisson Cloning (Solving) Each f x,y is a variable x i as before, solving As before this reduces to a sparse algebraic system f x,y-1 +f x-1,y -4f x,y +f x+1,y +f x,y+1 =divG(x,y) => x i-w +x i-1 -4x i +x i+1 +x i+w =divG(x,y)
21
Program Usage The program generates one output image Ex1 –clone Ex1 –clone x y x y Where x y are the offset for the paste
22
General Guidelines
23
Important Remarks You should write the programs in C or C++ or Matlab. Document your program thoroughly. In this assignment there is no need to open a window or use OpenGL in any way. Visit the exercise web-page http://www.cs.tau.ac.il/~tommer/adv-graphics/ex1.htm
24
Important Remarks The work can be done in pairs. Submit your work on diskettes (or CD’s). Hardcopy of the documentation. Do not print the source-code Do not print the source-code In the documentation: Answer the questions from exercise website In the documentation: Answer the questions from exercise website Points will be rewarded for nice and original images.
25
More Important Remarks Don't forget to check the number of parameters that your program receives. Don't forget to check memory allocations, if they succeeded or failed. Pay attention to the borders of the image. Visualize the gradients/div to better understand what is going on
26
A Little Help IrfanView – An image viewer, editor. FreeImage/CxImage – Open source libraries (C/C++) for working with images. TAUCS – Sparse solver See links on the exercise webpage Important questions: Email me tommer -a--t- tau.ac.il Email me tommer -a--t- tau.ac.il http://www.cs.tau.ac.il/~tommer/adv-graphics/ex1.htm
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.