View
6
Download
0
Category
Preview:
Citation preview
1
Today: Image Morphing• Introduction to image morphing
• Basic idea• Beier-Neely morphing
• Photography session for A4 portraits • Only ONE tutorial this week• Photos to be taken during the tutorial• Location: RW 143 (TA:Fransisco Estrada)• You will only have 2 chances to get your picture taken:
in this week’s tutorial, or in next week’s tutorial
Image Morphing
2
Extensions: View MorphingA combination of view synthesis & image morphing
Image MorphingA combination of generalized image warping with a cross-dissolve between pixels
Morphing involves two steps:• Pre-warp the two images• Cross-dissolve their colors
Source 1Source 1Image 1 Warp 2Warp 1 Image 2
Source 1Source 1
Morph
3
Cross-dissolveA weighted combination of two images, pixel-by-pixel
Combination controlled by a single interpolation parameter t:
Image 1
Cross-Dissolving Two Images
Image 2
D(r,c) = I1(r,c) + t*[I2(r,c)-I1(r,c)]
Why warp first?In order to align features that appear in both images (e.g., eyes, mouth, hair, etc). Without such an alignment, we would get a “double-image” effect!!
Image pre-warpingRe-position all pixels in the source images to avoid the “double-image” effect as much as possible
Pre-warping implemented using Backward Mapping Algorithm
Image Pre-WarpingSource 1Source 1Image 1 Warp 1 No pre-warping Pre-warping Warp 2 Image 2
4
Image MorphingA combination of generalized image warping with a cross-dissolve between pixels
Morphing involves two steps:• Pre-warp the two images• Cross-dissolve their colors
Source 1Source 1Source 1 Warp 2Warp 1 Source 2
Morph
Goal:Define a warp that moves every pixel in Image 1to its “corresponding” pixel in Image 2
Warping & cross-dissolve controlled by the same parameter t• For t near 0, pixels in morph are near their “original” position
in Image 1• For t near 1, they are near their “original” position in Image 2
Warping Between Two Images
Source 1Source 1Image 1 Image 2
5
Image MorphingBoth morphing steps specified by same parameter t
• Warp the two images according to t• Cross-dissolve their colors according to t
Source 1Source 1Source 1 Warp 2Warp 1 Source 2
Morphing videos generated by creating a sequence of images, defined by a sequence of t-values (e.g., 0,0.1,0.2,…,0.9,1)
Morphing ExampleImage 1
Image 2
Intermediate Images
6
Basic Question: How is the Morph Defined?Image 1 Intermediate Image
Today: Image Morphing• Introduction to image morphing
• Basic idea• Beier-Neely morphing
• Photography session for A4 portraits • Only ONE tutorial this week• Photos to be taken during the tutorial• Location: RW 143 (TA:Fransisco Estrada)• You will only have 2 chances to get your picture taken:
in this week’s tutorial, or in next week’s tutorial
7
Backward mapping algorithm:
for r = rmin to rmaxfor c = cmin to cmax
u = U(r,c,t)v = V(r,c,t)copy pixel at source (u,v)to destination (r,c)
Morphing w/ Backward Mapping
(u,v)
To completely determine the morph we need to define the functions U(r,c,t), V(r,c,t)
(r,c)
SourceImage 1
IntermediateImage t
• A single parameter t defines two warps, one applied to image 1 and one to image 2
Intermediate Morphs
Image 1
Image 2
pixel (r,c) in Warp 1 and pixel(r,c) in Warp 2 are in exact
correspondence
(r,c)
(r,c)
Warp 1
Warp 2
8
• Warped image computed using backward mappingalgorithm
• Image warp specified by interactively drawing lines in thetwo source images (Field Morphing)
Beier-Neely Field Morphing Algorithm (1992)
• Use corresponding lines in 2 images to define a re-positioning for every pixel according to parameter t
• Morphed image for t=0: Source image 1• Morphed image for t=1: Source image 2• Morphed image for 0<t<1: Intermediate morph
Beier-Neely’s Field Morphing Technique
9
Coordinate Map:A function that takes pixel (r,c) in Image 2 & movesit to pixel (r’,c’) in Image 1
Two cases:1. Coordinate map defined by a single line pair2. Coordinate map defined by multiple line pairs
Coordinate Maps in Field Morphing
Steps: 1. Compute position of pixel X in Image 2 relative to
destination line(r,c) → (u,v)
2. Compute (r’,c’) coordinates of pixel X’ in Image 1 whose position relative to source line is (u,v)(u,v) → (r’,c’)
Coordinate Maps from One Line Pair
destination line
source line
cc’
r’ r
10
Position of pixel X in Image 2 relative to destination line(r,c) → (u,v)
given by
Computing Pixel Positions Relative to a Line
(r,c)2PQ
)PQ).(PX(u
−
−−=
(rP ,cP)
(rQ,cQ)
2PQ
2PQ )cc()rr( −+−
)cc)(cc()rr)(rr( PQPPQP −−+−−
PQ)PQ(larPerpendicu).PX(v
−−−=
)rr,cc( PQPQ +−−
Examples
Pixel Coordinates Relative to a Line
11
Field warping algorithm (single -line case)For each pixel (r,c) in the destination image
find the corresponding (u,v) coordinates of the pixelfind the (r’,c’) in source image for that (u,v)color at destination pixel (r,c) = color at source pixel (r’,c’)
Coordinate Maps from One Line Pair
cc’
r’ r
Field warping algorithm (multiple-line case)1. Apply single-line field warping algorithm to each line
separately, to get N source pixel positions (ri’,ci’) for every destination pixel (N= # of line pairs)
2. Compute source position (r’,c’) as weighted average of positions (ri’,ci’)
Coordinate Maps from Multiple Line Pairs
12
Computing the Averaging Weights
(r,c)bp
distalength
weight
+=
2PQ
2PQ )cc()rr( −+−
1u0 if )v(abs <<0u if P from c)(r, of distance <1u if Q from c)(r, of distance >
controls influence of linefor points near it
For each pixel (r,c) in destination image
DSUM=(0,0)
weightsum = 0
for each line (Pi,Qi)
calculate (ui,vi)based on Pi,Qi
calculate (ri’,ci’)based on u,v & Pi’,Qi’
calculate displacementDi=Xi’-Xi for this line
calculate weightfor line (Pi,Qi)
DSUM += Di*weightweightsum += weight
(r’,c’) = (r,c) + DSUM/weightsum
color at destination pixel (r,c) = color at source pixel (r’,c’)
Beier-Neely Field Warping Algorithm
13
Warping Example
Morphing Example
14
Morphing Dynamic Scenes
Recommended