860 likes | 1.34k Views
Geometric Transformation & Projective Geometry. by: Diako Mardanbegi, PhD student. Transformation and Projective Geometry. Computer Vision: Relative movement of a camera Object locations wrt . Camera Graphics Describe objects and cameras in a scene and how they should move in 3D scene.
E N D
Geometric Transformation &Projective Geometry by: Diako Mardanbegi, PhD student
Transformation and Projective Geometry • Computer Vision: • Relative movement of a camera • Object locations wrt. Camera • Graphics • Describe objects and cameras in a scene and how they should move in 3D scene. • User interfaces (like WPF) relies heavy placing components relative to each other (2D) and for its 3D graphics engine.
Outline • 2-D Transformations • Representing Transformations • Homogeneous form • Multiple frames • Cartesian Coordinate System • Describe a local frame • Orientation • Translation • Mapping between multiple frames • 3-D Transformations • Euler angles • Quaternion • Projective coordinate system • Homography
2-D Translation y x
2-D Rotation about the origin a b Rotation about the origin
2-D Rotation about the origin a b Rotation about the origin
2-D Rotation about a specified point a d o’ o’ b c o’ Rotation about a specified point
2-D Scaling relative to the origin Vertical shift proportional to vertical position Horizontal shift proportional to Horizontal position
2-D Scaling relative to the origin a b Scaling relative to the origin
2-D Scaling relative to a specified point Scaling relative to a specified point
Representing transformations , , , • Trick of additional coordinate makes this possible to express all transformations in a common linear form • Old way: • Cartesian coordinates • New way: • With additional coordinate (Homogeneous coordinates)
Representing transformations homogeneous transformation: linear transformation of homogeneous coordinates x‘ = H x In homogeneous form In homogeneous form
from Cartesian coordinates to Homogeneous coordinates • from Homogeneous coordinates to Cartesian coordinates
Advantages • Easy to compose multiple transformations after each other • Combination of all transformations into a single matrix
Advantages a d • for example :General 2-D Pivot-Point Rotation o’ o’ b c o’
Inverse of transformations • Easy to invert
Other 2-D transformations • Reflection • Shear 2
Homography matrix • Full-generality 3 x 3 homogeneous transformation
Homography matrix • Full-generality 3 x 3 homogeneous transformation Translation components
Homography matrix • Full-generality 3 x 3 homogeneous transformation Scale/rotation components
Homography matrix • Full-generality 3 x 3 homogeneous transformation Shear/rotation components
Homography matrix • Full-generality 3 x 3 homogeneous transformation Homogeneous scaling factor
Homography matrix • Full-generality 3 x 3 homogeneous transformation When these are zero (as they have been so far), H is an affine transformation
Why we are using only one fixed Cartesian system? • Why we don’t define a local coordinate system? a d o’ o’ o’ b c o’
We can do it, but first know about: • What is exactly a cartesian coordinate system? • How to describe a local frame in a fixed frame? • How to express a point in each frame?
Cartesian Coordinate System y-axis • A coordinate system in Rn is defined by an origin oand n orthogonal basis vectors • In R3, positive direction of each axis X, Y, Z is indicated by unit vector i, j, k • Let P = (x, y, z)T be a point in R3 • Coordinate is length of projection of vector from origin to point onto axis basis vector What do these values mean? . P j i x-axis k O ? z-axis
Vector Projection • The projection of vector a onto u is that component of a in the direction of u
Y’ Y . P X’ B X A
Describe a local frame in a fixed frame A,B Y Y Y Y’ Y’ Y’ homogeneous form X’ X’ X’ X X X A,B : orientation of frame B relative to A B (x, y) : translation of frame B relative to A A
Mapping from frame to frame Y’ Y . P X’ B A X A Mapping Transformation
Going from 2D to 3D • Vector cross product • Definition: If a=(xa, ya, za)T and b=(xb, yb, zb)T, then: c=ax b =(yazb-zayb, zaxb - xazb, xayb- yaxb)T • c is orthogonal to both aand b (direction given by right-hand r with magnitude k=ixj
3-D Translation P’ = T . P
3-D Rotation • In 2-D, we are always rotating in the plane of the image, but in 3-D the axis of rotation itself is a variable • Three canonical rotation axes are the coordinate axes X, Y, Z
3-D Rotation • Similar to 2-D rotation matrices, but with coordinate corresponding to rotation axis held constant
3-D Rotation • When object is to be rotated about an axis that is parallel to one of the coordinate axes
3-D Rotation Easiest way ?! • When an object is to be rotated about an axis that is not parallel to one of the coordinate axes
Hierarchy of frames +Yworld +Xworld +Zworld
3-D Camera Coordinates • Right-handed system • From point of view of camera looking out into scene: • +X right, -Xleft • +Ydown, -Y up • +Z in front of camera,-Zbehind
+Yworld +Xworld +Zworld Creating a simple WPF 3D space with camera: http://www.codeproject.com/KB/WPF/Wpf3DPrimer.aspx
Orientation in 3-D • in 2D we have 4 elements in orientation matrix but we can locate the local frame by having only one angle . (we know the axis) • in 3D we have 9 elements but how many angles do we need for locating the local frame in space? • only 3
Euler’s Theorem Euler’s Theorem : “Any two independent orthonormal coordinate frames can be related by a sequence of rotations (not more than three) about coordinate axes, where no two successive rotations may be about the same axis”
Z-Y-X Euler angles • Start with the frame coincident with a known frame {A}. Rotate {B} first about ZB by an angle , then about YBby an angle and, finally, about XB by an angle