Multimedia Programming 07: Image Warping Keyframe Animation Departments of Digital Contents Sang Il Park
Outline Review Image Warping –Translation Keyframe Animation
Review Image Warping –Scaling –Rotation –Together with a 2X2 matrix
Image Processing 2-2 Image Warping (Translation) Lots of slides taken from Alexei Efros
Review: 2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Identity? 2D Scale around (0,0)?
Review: 2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Rotate around (0,0)? 2D Shear?
Review: 2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Mirror about Y axis? 2D Mirror over (0,0)?
Review: 2x2 Matrices What types of transformations can be represented with a 2x2 matrix? 2D Translation? Only linear 2D transformations can be represented with a 2x2 matrix NO!
All 2D Linear Transformations Linear transformations are combinations of … –Scale, –Rotation, –Shear, and –Mirror Properties of linear transformations: –Origin maps to origin –Lines map to lines –Parallel lines remain parallel –Ratios are preserved –Closed under composition
Translation How can we represent translation? How can we represent it as a matrix?
Homogeneous Coordinates Homogeneous coordinates –represent coordinates in 2 dimensions with a 3-vector ( 동차좌표 )
Homogeneous Coordinates Q: How can we represent translation as a 3x3 matrix? A: Using the rightmost column:
Translation Example of translation t x = 2 t y = 1 Homogeneous Coordinates
Add a 3rd coordinate to every 2D point –(x, y, w) represents a point at location (x/w, y/w) –(x, y, 0) represents a point at infinity –(0, 0, 0) is not allowed Convenient coordinate system to represent many useful transformations (2,1,1) or (4,2,2)or (6,3,3) x y
Basic 2D Transformations Basic 2D transformations as 3x3 matrices Translate Rotate Scale
Affine Transformations Affine transformations are combinations of … –Linear transformations, and –Translations Properties of affine transformations: –Origin does not necessarily map to origin –Lines map to lines –Parallel lines remain parallel –Ratios are preserved –Closed under composition –Models change of basis ( 유사변환 )
Projective Transformations Projective transformations … –Affine transformations, and –Projective warps Properties of projective transformations: –Origin does not necessarily map to origin –Lines map to lines –Parallel lines do not necessarily remain parallel –Ratios are not preserved –Closed under composition –Models change of basis ( 사영변환 )
Matrix Composition Transformations can be combined by matrix multiplication p’ = T(t x,t y ) R( ) S(s x,s y ) p Sequence of composition 1.First, Scaling 2.Next, Rotation 3.Finally, Translation
Inverse Transformation Translate Rotate Scale
Inverse Transformation p’ = T(t x,t y ) R( ) S(s x,s y ) p P = S -1 (s x,s y ) R -1 ( ) T -1 (t x,t y ) p’
2D image transformations These transformations are a nested set of groups Closed under composition and inverse is a member
Keyframe Animation
Keyframes? –Define starting and ending points of any smooth transitions The workflow of traditional hand-drawn animation –1. Key frames by senior key artists –2. ‘clean-up’ and ‘inbetweens’ by inbetweeners keyframesinbetweens
Keyframe Animation The starting keyframe The ending keyframeThe completed animation
Keyframing: issues How do you know where to put the keyframes? Interface: How do you actually specify the key values? Inbetween: How do you make frames between keys
Making inbetweens Interpolation Start Time = 0 End Time = 1 Inbetween Time = α (0 ≤ α ≤1) ??
Making inbetweens Linear Interpolation Start Time = 0 End Time = 1 Inbetween Time = α (0 ≤ α ≤1) 1-αα
State vector How to represent a state? –By Numbers! (or Parameters!) –Examples) Color: R,G,B (H,S,V) Scale: Sx, Sy Rotation: θ Translation: Tx, Ty Position of vertices …
State vector A state vector: a collection of parameters –Example with 5 parameters Scale: Sx, Sy Rotation: θ Translation: Tx, Ty
Interpolation of state vector Keyframes: (at time=0) (at time=1)
Interpolation of state vector What is the state vector at time = α ? 1-αα α
Interpolation of state vector What is the state vector at time = α ? 1-αα α