Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS1315: Introduction to Media Computation

Similar presentations


Presentation on theme: "CS1315: Introduction to Media Computation"— Presentation transcript:

1 CS1315: Introduction to Media Computation
Feature Based Image Morphing

2 Image Morphing Examples

3 Technique This technique is based Beier-Neely feature-based image metamorphosis paper

4 Feature Based Morphing
The idea of feature based morphing is that lines are drawn over prominent features in each image, e.g. eyes, nose, mouth, etc. Over time the lines in the source image are moved towards the lines in the destination image, which creates the warping effect on the image While the lines are moving, the surrounding pixels are transformed based on the movement A cross-dissolve, or a type of blending, is performed to transform the colors of the source image to the colors of the destination image

5 Single Line Transformation
We define a line from point P’ to point Q’ in the source image We define another line from point P to point Q in the destination image

6 Single Line Transformation
u = (X-P)*(Q-P) ||Q-P||^2 v = (X-P)*Perp(Q-P) ||Q-P|| X’ = P’ + u*(Q’-P’) + v*Perp(Q’-P’) ||Q’-P’|| Note: * is the dot product For each pixel in the destination image, we calculate three values to re-map the current pixel in the source image caused by the line warping u is the position along the from P to Q v is the perpendicular distance from the line from P to Q X’ is the re-mapped pixel value

7 Single Line Transformation
Example: The destination image pixel at (50, 35) is replaced with the source image pixel at (80, 56)

8 Multiple Line Transformations
Generating the warping effect with multiple lines is basically the same as with a single line, but the u, v, and X’ calculations are performed by comparing each pixel to each line in the list of lines Because different lines should effect pixels more or less, depending on relative location and line length, three new constants are introduced a = line strength by proximity If a is barely > 0, if line is very close to the pixel, the strength is nearly infinite. Larger values provide smoother warping, but less preciseness. b = line strength by relative distance Typical Range: [0.5, 2] If b is 0, all lines contribute equally regardless of distance p = line strength by weight Typical Range: [0, 1] If p is 0, all lines have same weight, if p is 1 longer lines have greater weight than shorter lines

9 Multiple Line Transformations
These new constants a, b, and p are used to calculate a weight that is added to the X’ pixel value to adjust the value according to relative line strength weight = ( length^p / (a + distance) )^b Add more details here

10 Morphing Two Images The source image lines and destination image lines are interpolated over time. This provides a gradual transition from the source image to the destination image To provide the best looking morph, the source lines and the destination lines are is warped towards the interpolated lines. This allows the features to line up for each frame and generates a more smooth and gradual morph As the lines are warped, the images are cross-dissolved to enhance the transition

11 Cross-Dissolve Add code here

12 Morphing Movie Once all the morphing frames are created and saved to a new image, the frames can be turned into a movie Add movie code calls here


Download ppt "CS1315: Introduction to Media Computation"

Similar presentations


Ads by Google