Post on 21-Jan-2016
transcript
Project Image Morphing
Presented By
Sharmila Gupta
Digital Image Manipulation
Compositing
Convolution
Dithering
Warping
Interpolation/ Extrapolation
Morphing
Simple pixel Modification
Simple Pixel Modification
Convert to Gray f(r,g,b) = .3r + .52g + 10b
Invert f(v) = 1-v
Brighten/darken f(v) = ßv for ß >= 0
Threshold if v > threshold then f(v) = 1 else f(v) = 0
Applying same degree of change in every pixel
Image Interpolation/Extrapolation
Change Contrast
Change Saturation
Original More Contrast Less Contrast
Offers a general, unifying approach to many common point and area image processing operations.
Brightness, contrast, saturation, tint, and sharpness can all be controlled with one formula, separately or simultaneously.
Original More Saturated Less Saturated
Image Interpolation/Extrapolation
Brighten/darken
Noise removal
Original More Bright Less Bright
median filtered imageImage with “impulse” noise
Compositing
Compisiting images involves combining separate image layers into one
Layers may be moved and arranged.
CompositeOriginal
Convolution
Edge Enhancement
Blur-ness
Original Edge Defined
De-blurredBlurred
Used for different image processing, removing blur-ness, defining edge, restore special effect by filtering, masking or other technique.
DitheringMonitors and image files limited to 256 colors can create the illusion of more colors by Dithering the available colors in a scattered pattern, approximating the desired color. Image editors often use dithering to convert true color images to indexed color images.
True-color Image Dithered Image
What is Image Morphing?
It comes from the word Metamorphosis
Metamorphosis: Change shape, size, form or appearance
Image Morphing
Transition from one object to another
What is Image Morphing ?
Morphing can be defined as:
Process of transforming one image into another.
An animation technique that allows you to blend two still images, creating a sequence of in – between pictures that when played in Quick Time, metamorphoses the first image into the second.
A process of transforming two images where it seems like the first melts, dissolves and re-arranges itself to become the second one
What is Image Morphing ?contd..
How is Morphing done?
First image is gradually distorted and is faded out
General View
The second image starts out totally distorted toward the first and is faded in.
It is broadly two-step process:
Classification of MorphingMorphing classified into three types
Image-based Method
Volume-based approaches
Boundary representations (B-rep) -based approaches
WarpingWarping two images to make them having the same shape
Image-based Morphing
Cross dissolvingCross dissolving the resulting images
Two steps are:
Image-based Morphing
WARPING ?
Image-Based Morphing - Warping
Warping an image means apply a given deformation to it
Two ways to warp an image:
A warp is a 2-D geometric transformation and generates a distorted image when it is applied to an image
Forward Mapping
Reverse Mapping
Forward Mapping
Each pixel in the source image is mapped to an appropriate pixel in the destination image.
Some pixels in the destination image may not be mapped
Source Image
Source Image
Destination Image
Destination Image
Reverse Mapping
This method goes through each pixel in the destination image and samples an appropriate source image pixel
All destination image pixels are mapped to some source image pixel.
This mapping used in the Beier/Neely line morphing method.
Cross Dissolving A cross-dissolve is a sequence of images which
implements a gradual fade from one to the other.
Very primitive
No smooth transition
Image-based Morphing - Example
Image-based Morphing - Example
Do Morphing
Source Image Destination Image
Image-based Morphing - Example
Baby to Grandpa Morphing
Groom to Bride Compositing
Warping
Image-Based Morphing - Other option ! Better option than Cross - Dissolving:
Field/Line Morphing
Mesh Mapping
Multilevel Free-form Deformation (MFFD)
Field/Line Morphing
What pixel coordinate in the source image do we sample for each pixel in destination image ?
Correspondence achieved using feature line(s) in source and destination images
Source Image Destination Image
Field/Line Morphing
Two step process
Step I : Interpolating the lines: Interpolate the coordinates of the end points of every
pair of lines.
Step II : Warping the Images: Each of the source images has to be deformed towards the needed frame. The deformation works pixel by pixel is based on the reverse mapping. This algorithm is called Beier-Neely Algorithm.
BEIER-NEELY ALGORITHM
Divide the two image to be morphed into lines
Create Intermediate Morph for both images
BEIER-NEELY ALGORITHM (contd.)
Intermediate Morph ? Use corresponding lines in both the images to redefine a new
position for each pixel according to a parameter t If t = 0 for First image and t = 1 for Second Image then
Intermediate Morph: 0<t<1
BEIER-NEELY ALGORITHM (contd.) Compute line endpoints in the intermediate morph
A = endpoint of a line in First image
B = endpoint of a line in Second image
AB = endpoint of the line in Intermediate image = (1-t)*A+t*B
Use Field Morphing to warp First Image according to intermediate line endpoints
Use Field Morphing to warp Second Image according to intermediate line endpoints
Cross-Dissolve the warped images using t to define weighted pixel average
BEIER-NEELY ALGORITHM (contd.)
Cross Dissolve the intermediate warped images
Warped First Image Warped Second Image
BEIER-NEELY ALGORITHM - PIXEL POSITION1) Compute position of pixel X in destination image
relative to the line drawn in destination image.(x,y) (u,v)
X
P
Q
P’
Q’
u
v
Destination Image Source Image
Compute coordinates of pixel in source image whose position relative to the line drawn in source image is (u,v). (u,v) (x’,y’)
X
P
Q
P’
Q’
u
v
u
v
Destination Image Source Image
BEIER-NEELY ALGORITHM - PIXEL POSITION
Computation of pixel X with respect to Line
X (x,y)
P (px,py)
Q (qx,qy)
u
v
Destination Image
(x,y) (u,v)(x-px)(qx-px)+(y-py)(qy-
py)
(X-P).(Q-P)
||(Q-P)||2
(X-P).Perpendicular(Q-P)
||(Q-P)||
(qx-px)+(qy-py)
(qy-py, -qx+px)
BEIER-NEELY ALGORITHM - PIXEL POSITION
BEIER-NEELY ALGORITHM-WEIGHTED AVG. Computation of weighted pixel average
X (x,y)
P (px,py)
Q (qx,qy)
u
v
Weight =lengthp
a + dist
b
length = (qx-px)2 + (qy-py)2length = (qx-px)2 + (qy-py)2
dist = abs(v) if o<u<1or
dist = distance of (x,y) from P if u < 0or
dist = distance of (x,y) from Q if u > 1
dist = abs(v) if o<u<1or
dist = distance of (x,y) from P if u < 0or
dist = distance of (x,y) from Q if u > 1(a,b) controls influence of line for points near it
(a,b) controls influence of line for points near it
BEIER-NEELY ALGORITHM
For each pixel X=(x,y) in the destination image DSUM=(0,0) , weightsum=0 for each line(Pi, Qi) calculate(ui,vi) based on Pi, Qi calculate (xi’, yi’) based on u,v and Pi, Qi calculate displacement Di = Xi’ – X for this line compute weight for line(Pi,Qi)
DSUM+=Di*weight
weightsum+=weight
(x’y’) = (x,y)+DSUM/weightsum color at destination pixel(x,y) = color at source pixel(x’y’)
Mesh Morphing
Mesh is a rough presentation of an object
Meshed Image
Source and Destination images are meshed
Meshes for both images are interpolated
How it is done ?
Intermediate images are cross-dissolved
Mesh Morphing-Algorithm
• for each frame f do
– Linearly interpolate mesh M, between Ms and Mt
– warp Images to I1, using meshes Ms and M
– warp Imaget to I2, using meshes Mt and M
– Linearly interpolate image I1 and I2
• end
Mesh Morphing
Mesh Morphing - Pros and Cons
Hard to fit the mesh in the image
All control points affects the warping equally.
Not enough control on certain points when needed.
Pros
Cons
A Mesh A Rendered Image
Multilevel Free Form Deformation (MFFD) Morphing two sequences of live action, rather than
just two still images
Mark all features in key frames
Interpolate the features between key frames
Do image metamorphosis on set of image pairs
Multilevel Free Form Deformation (MFFD)
Volume Based Approaches Technique:
The objects are expressed as level sets of distance functions
Two steps:
Warp: deform the 3D space in order to make the two objects to be morphed coincide as much as possible
Interpolation: linear interpolate distance fields deformed by the warp
Interaction: The user interface allows to select feature (or anchor)
points in each voxelized object space and map the anchor points of the source object to the anchor points of the target object
Volume Based Approaches - Example
Volume Based Approaches - Example
Volume Based Approaches
D. Cohen-Or, D. Levin, A. Solomovoci. Three-dimensional distance field metamorphosis. ACM Trans. Graphics 17:116-141, 1998
http://www.math.tau.ac.il/~levin/
B-Rep Based Approaches
Polyhedral Morphing using Feature based surface decomposition
The users only need to specify a few corresponding pairs of features on the two polyhedra. They can then specify the trajectories along which these features travel during the morph using Bezier curves, as shown in the next page.
The algorithm not only provides the user with high-level control in terms of specifying the features and trajectories, it also allows for local refinement
B-Rep Based Approaches
Destination Image Source Image
B-Rep Based Approaches
B-Rep Based Approaches
A. Gregory, A. State, M. C. Lin, D. Manocha, and M. A. Livingston. Interactive surface decomposition for polyhedral morphing. The Visual Computer (1999) 15:453-470
http://www.cs.unc.edu/~geom/3Dmorphing/
B-Rep Based Approaches - Examples
http://www.cs.unc.edu/~gregory/morphs/jj.mpg
Jack and Jill
Coffecup to Donut
http://www.cs.unc.edu/~gregory/morphs/donut2cup.mpg
Project Image Morphing