Image WarpingSlide 2Slide 3Parametric (global) warpingSlide 5ScalingSlide 7Slide 82-D RotationSlide 10Slide 112x2 MatricesSlide 13Slide 14Slide 15All 2D Linear TransformationsLinear Transformations as Change of BasisHomogeneous CoordinatesSlide 19Slide 20Slide 21TranslationBasic 2D TransformationsAffine TransformationsProjective TransformationsMatrix Composition2D image transformationsImage Warping15-463: Computational PhotographyAlexei Efros, CMU, Fall 2007Some slides from Steve Seitzhttp://www.jeffrey-martin.comImage Warpingimage filtering: change range of imageg(x) = T(f(x))fxTfxfxTfximage warping: change domain of imageg(x) = f(T(x))Image WarpingTTffggimage filtering: change range of imageg(x) = h(T(x))image warping: change domain of imageg(x) = f(T(x))Parametric (global) warpingExamples of parametric warps:translationrotationaspectaffineperspectivecylindricalParametric (global) warpingTransformation T is a coordinate-changing machine:p’ = T(p)What does it mean that T is global?•Is the same for any point p•can be described by just a few numbers (parameters)Let’s represent T as a matrix: p’ = MpTp = (x,y) p’ = (x’,y’)yxyxM''ScalingScaling a coordinate means multiplying each of its components by a scalarUniform scaling means this scalar is the same for all components: 2Non-uniform scaling: different scalars per component:ScalingX 2,Y 0.5ScalingScaling operation:Or, in matrix form:byyaxx''yxbayx00''scaling matrix SWhat’s inverse of S?2-D Rotation(x, y)(x’, y’)x’ = x cos() - y sin()y’ = x sin() + y cos()2-D Rotationx = r cos ( )y = r sin ()x’ = r cos ( + )y’ = r sin ( + )Trig Identity…x’ = r cos( ) cos() – r sin() sin()y’ = r sin() cos() + r cos() sin()Substitute…x’ = x cos() - y sin( )y’ = x sin() + y cos()(x, y)(x’, y’)2-D RotationThis is easy to capture in matrix form:Even though sin() and cos() are nonlinear functions of ,•x’ is a linear combination of x and y•y’ is a linear combination of x and yWhat is the inverse transformation?•Rotation by –•For rotation matrices yxyxcossinsincos''TRR 1R2x2 MatricesWhat types of transformations can be represented with a 2x2 matrix?2D Identity?yyxx''yxyx1001''2D Scale around (0,0)?ysyxsxyx*'*'yxssyxyx00''2x2 MatricesWhat types of transformations can be represented with a 2x2 matrix?2D Rotate around (0,0)?yxyyxx*cos*sin'*sin*cos'yxyxcossinsincos''2D Shear?yxshyyshxxyx*'*'yxshshyxyx11''2x2 MatricesWhat types of transformations can be represented with a 2x2 matrix?2D Mirror about Y axis?yyxx''yxyx1001''2D Mirror over (0,0)?yyxx''yxyx1001''2x2 MatricesWhat types of transformations can be represented with a 2x2 matrix?2D Translation?yxtyytxx''Only linear 2D transformations can be represented with a 2x2 matrixNO!All 2D Linear TransformationsLinear transformations are combinations of …•Scale,•Rotation,•Shear, and•MirrorProperties of linear transformations:•Origin maps to origin•Lines map to lines•Parallel lines remain parallel•Ratios are preserved•Closed under compositionyxdcbayx''yxlkjihgfedcbayx''Linear Transformations as Change of BasisAny linear transformation is a basis!!!•What’s the inverse transform? •How can we change from any basis to any basis?•What if the basis are orthogonal?j =(0,1)i =(1,0)pp=4i+3j = (4,3) p’=4u+3vpx’=4ux+3vxpy’=4uy+3vyv =(vx,vy)u=(ux,uy)p’ppyyxxyyxxvuvuvuvu34'Homogeneous CoordinatesQ: How can we represent translation as a 3x3 matrix?yxtyytxx''Homogeneous CoordinatesHomogeneous coordinates•represent coordinates in 2 dimensions with a 3-vector 1coords shomogeneouyxyxHomogeneous CoordinatesAdd 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 allowedConvenient coordinate system to represent many useful transformations1212(2,1,1)or (4,2,2) or (6,3,3)xyHomogeneous CoordinatesQ: How can we represent translation as a 3x3 matrix?A: Using the rightmost column:1001001yxttranslationTyxtyytxx''TranslationExample of translation1110010011''yxyxtytxyxttyxtx = 2ty = 1Homogeneous CoordinatesBasic 2D TransformationsBasic 2D transformations as 3x3 matrices11000cossin0sincos1''yxyx110010011''yxttyxyx110001011''yxshshyxyxTranslateRotate Shear110000001''yxssyxyxScaleAffine TransformationsAffine transformations are combinations of …•Linear transformations, and•TranslationsProperties 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 basiswyxfedcbawyx100''Projective TransformationsProjective transformations …•Affine transformations, and•Projective warpsProperties of projective transformations:•Origin does not necessarily map to
View Full Document