1/30 Warps and Morphs Applications of Linear Algebra � Mike Land and Tara Puzin � College of the Redwoods � Mathematics Department, Eureka, California � email: michaelland37@yahoo.com � email: toootsiepop@yahoo.com � �
Introduction • What is Morphing? 2/30 • The word morph derives from the word metamorphosis meaning to change shape or form. • Morphing is achieved by compiling several images that are gradually distorted and faded out while the destination image is faded in. � • In this presentation we will develop a mathematical process that � allows for the metamorphosis of one digital image into another. � � � � �
An Example of Morphs and Warps 3/30 � � � • The girl in the picture morphs into a frog. � � � �
Objective 4/30 � � Destination Image Source Image � � � � �
Process • In order to achieve this we will draw a line on the source image and 5/30 destination image. � � Destination Image Source Image � � � � �
First Steps 6/30 • In order to calculate the color we let each pixel be represented by X and X ′ . • We will calculate the color of X ′ in the source image and pour that color into X in the destination image. • In order to accomplish this we will need to calculate u and v . � � • u is a percentage up the line PQ , and v is a set distance away from � the line PQ . � � � �
Finding u 7/30 Start with X in the destination Q image. Project − PX onto − − → → PQ to deter- X mine u . u u = ( X − P ) · ( Q − P ) � ( Q − P ) · ( Q − P ) � P � Destination Image � � � �
Finding v 8/30 Project − − → PX onto the unit vector Q perpendicular to − → PQ . X v v = ( X − P ) · perp ( Q − P ) | ( Q − P ) | u perp( Q − P ) � � perp( Q − P ) / | Q − P | P � Destination Image � � � �
Finding X ′ in Source Image 9/30 Q ′ Start at P ′ . Move along − − → P ′ Q ′ the same per- centage u that we moved along v − → X ′ PQ in the destination image. Move perpendicular to − − → P ′ Q ′ a u � distance v , the same v com- � puted in the destination image. P ′ � Source Image � � � �
Calculating X ′ 10/30 X ′ = P ′ + u · ( Q ′ − P ′ ) + v · perp ( Q ′ − P ′ ) | ( Q ′ − P ′ ) | � � � � � � �
One Line 11/30 � Destination Image Source Image � � � � � �
Warp with One Line 12/30 � � Destination Image Source Image � � � � �
Two Lines 13/30 Q 2 Q 1 v 2 v 1 X u 2 u 1 P 2 � P 1 � � Destination Image � � � �
Calculating u 1 , u 2 , v 1 , and v 2 14/30 u 1 = ( X − P 1 ) · ( Q 1 − P 1 ) ( Q 1 − P 1 ) · ( Q 1 − P 1 ) u 2 = ( X − P 2 ) · ( Q 2 − P 2 ) ( Q 2 − P 2 ) · ( Q 2 − P 2 ) v 1 = ( X − P 1 ) · perp ( Q 1 − P 1 ) � | ( Q 1 − P 1 ) | � � � v 2 = ( X − P 2 ) · perp ( Q 2 − P 2 ) � | ( Q 2 − P 2 ) | � �
Calculate X ′ 1 and X ′ 2 15/30 Q ′ 1 Q ′ 2 v 1 X ′ 1 v 2 X ′ 2 u 1 u 2 � � P ′ � 2 P ′ Source Image 1 � � � �
Calculate the Displacement 16/30 Q ′ 1 Q ′ 2 Calculate the displacements D 1 and D 2 in order to find X ′ . X v 1 D 1 v 2 D 2 X ′ 1 X ′ D 1 = X ′ 1 − X 2 u 1 u 2 D 2 = X ′ 2 − X � � P ′ 2 � P ′ Source Image 1 � � � �
Calculate the Weight for Each Displace- ment. 17/30 We now want to compute a weighted average of our displacements. We use the following formula for the weights. � length p � b Weight = a + dist � Length is the length of the line P i Q i � Dist is the distance from the pixel to the line. � � Parameters a , b , and p are constants that can be used to change the � relative effect of the lines. � �
Weighted Average 18/30 Q ′ 1 Q ′ 2 X v 1 D 1 v 2 D 2 X ′ 1 X ′ 2 u 1 u 2 � P ′ � 2 P ′ Source Image 1 � � W 1 D 1 + W 2 D 2 � W 1 + W 2 � �
Calculating X ′ by Adding the Weighted Average 19/30 Q ′ 1 Q ′ 2 X v 1 v 2 X ′ 1 X ′ 2 u 1 u 2 � X ′ � � P ′ 2 P ′ Source Image 1 � � � �
X ′ = X + W 1 D 1 + W 2 D 2 W 1 + W 2 20/30 � � � � � � �
Warp with Two Lines 21/30 � � Destination Image Source Image � � � � �
Warp with Two Lines 22/30 � � Destination Image Source Image � � � � �
Back to Our Objective 23/30 � � Destination Image Source Image � � � � �
Rush Lines to Squid man Lines 24/30 � � Rush Destination Rush Source � Image Image � � � �
Rush Sequence Lines 25/30 � � � � � � �
Warp Rush Sequence 26/30 � � � � � � �
Rush to Squid Man Lines 27/30 � � � � � � �
Squid Man to Rush Lines 28/30 � � � � � � �
Forwards and Backwards 29/30 � � � � � � �
Blending the Morph 30/30 � � � � � � �
Recommend
More recommend