Unique representation Recall idea of coordinate system for a vector space V : ◮ Generators a 1 , . . . , a n of V ◮ Every vector v in V can be written as a linear combination v = α 1 a 1 + · · · + α n a n ◮ We represent vector v by its coordinate representation [ α 1 , . . . , α n ] Question: How can we ensure that each point has only one coordinate representation? Answer: The generators a 1 , . . . , a n should form a basis. Unique-Representation Lemma Let a 1 , . . . , a n be a basis for V . For any vector v ∈ V , there is exactly one representation of v in terms of the basis vectors.
Uniqueness of representation in terms of a basis Unique-Representation Lemma: Let a 1 , . . . , a n be a basis for V . For any vector v ∈ V , there is exactly one representation of v in terms of the basis vectors. Proof: Let v be any vector in V . The vectors a 1 , . . . , a n span V , so there is at least one representation of v in terms of the basis vectors. Suppose there are two such representations: v = α 1 a 1 + · · · + α n a n = β 1 a 1 + · · · + β n a n We get the zero vector by subtracting one from the other: 0 = α 1 a 1 + · · · + α n a n − ( β 1 a 1 + · · · + β n a n ) = ( α 1 − β 1 ) a 1 + · · · + ( α n − β n ) a n Since the vectors a 1 , . . . , a n are linearly independent, the coefficients α 1 − β 1 , . . . , α n − β n must all be zero, so the two representations are really the same. QED
Uniqueness of representation in terms of a basis: The case of graphs Unique-Representation Lemma Let a 1 , . . . , a n be a basis for V . For any vector v ∈ V , there is exactly one representation of v in terms of the basis vectors. Main Quad Pembroke Campus Athletic Complex Wriston Quad Keeney Quad Bio-Med Gregorian Quad A basis for a graph is a spanning forest. Unique Representation shows that, for each edge xy in the graph, ◮ there is an x -to- y path in the spanning forest, and ◮ there is only one such path.
Change of basis Examples: Lossy compression of images (described earlier) or audio (0,0,1) (1,0,1) (1,0,0) (0,0,0) Perspective rendering (0,1,1) (1,1,1) (0,1,0) (1,1,0) Removing perspective from an image
Change of basis Suppose a 1 , . . . , a n is a basis for V . How do we go ◮ from a vector b in V Important special case: ◮ to the coordinate representation u of b in terms of V = F m . a 1 , . . . , a n ? Function f : F n − → F m By linear-comb. definition of matrix-vector mult., defined by f ( x ) = a 1 x is a n · · · a 1 u b = a n · · · ◮ onto (because a 1 , . . . , a n are generators for F m ) By Unique-Representation Lemma, ◮ one-to-one (by u is the only solution to the equation Unique-Representation Lemma) a 1 x = b a n · · · so f is an invertible function so the matrix is invertible. so we can obtain u by solving a matrix-vector equation.
Change of basis Now suppose a 1 , . . . , a n is one basis for V and c 1 , · · · , c k is another. a 1 x c 1 y and define g ( y ) = Define f ( x ) = a n c k . · · · · · · Then both f and g are invertible functions. The function f − 1 ◦ g maps ◮ from coordinate representation of a vector in terms of c 1 , . . . , c k ◮ to coordinate representation of a vector in terms of a 1 , . . . , a n In particular, if V = F m for some m then a 1 c 1 f invertible implies that a n g invertible implies that c k · · · · · · is an invertible matrix. is an invertible matrix. Thus the function f − 1 ◦ g has the property − 1 ( f − 1 ◦ g )( x ) = a 1 c 1 x a n c k · · · · · ·
Change of basis Proposition: If a 1 , . . . , a n and c 1 , . . . , c k are bases for F m then multiplication by the matrix − 1 a 1 c 1 B = a n c k · · · · · · maps ◮ from the coordinate representation of a vector with respect to c 1 , . . . , c k ◮ to the coordinate representation of that vector with respect to a 1 , . . . , a n . Conclusion: Given two bases of F m , there is a matrix B such that multiplication by B converts from one coordinate representation to the other. Remark: Converting between vector itself and its coordinate representation is a special case: ◮ Think of the vector itself as coordinate representation with respect to standard basis.
Change of basis: simple example Example: To map from coordinate representation with respect to coordinate representation with respect to [1 , 2 , 3] , [2 , 1 , 0] , [0 , 1 , 4] to [2 , 0 , 1] , [0 , 1 , − 1] , [1 , 2 , 0] multiply by the matrix − 1 2 0 1 1 2 0 0 1 2 2 1 1 1 − 1 0 3 0 4 which is 2 − 1 − 1 1 2 0 3 3 3 2 − 1 − 4 2 1 1 3 3 3 − 1 2 2 3 0 4 3 3 3 which is − 5 − 1 1 3 − 17 − 4 1 3 10 3 0 3
Perspective rendering As application of change of basis, we show how to synthesize a camera view from a set of points in three dimensions, taking into account perspective. The math will be useful in next lab, where we will go in the opposite direction, removing perspective from a real image. For reasons that will become apparent, we We start with the points making up a wire translate the cube, adding (1 , 1 , 8) to each cube: point. (0,0,1) (1,0,1) (1,1,9) (2,1,9) (0,0,0) (1,0,0) (2,1,8) (1,1,8) (0,1,1) (1,1,1) (1,2,9) (2,2,9) (0,1,0) (1,1,0) (1,2,8) (2,2,8) How does a camera (or an eye) see these points?
Simplified camera model Simplified model of a camera: Camera Center ◮ There is a point called the camera center . ◮ There is an image sensor array in the back of the camera. ◮ Photons bounce off objects in the scene and travel through the camera center to the image sensor array. ◮ A photon from the scene only reaches the image sensor array if it travels in a straight line through the camera center. ◮ The image ends up being inverted.
Even more simplified camera model Even simpler model to avoid the inversion: image plane ◮ The image sensor array is between the camera center and the scene. ◮ The image sensor array is located in a plane, called the image plane . ◮ A photon from the scene is detected by the sensor array only if it is traveling in a straight line towards the camera center. camera center ◮ The sensor element that detects the photon is the one intersected by this line. ◮ Need a function that maps from point p in point p in world world to corresponding point q in image plane image plane
Camera coordinate system Camera-oriented basis helps in mapping from world points to image-plane points: ◮ The origin is defined to be the camera center. image plane (That’s why we translated the wire-frame a 1 cube.) ◮ The first vector a 1 goes horizontally from the top-left corner of a sensor element to the a 2 top-right corner. ◮ The second vector a 2 goes vertically from the top-left corner of a sensor element to the a 3 bottom-left corner. ◮ The third vector a 3 goes from the origin (the camera center) to the top-left corner of sensor origin element (0,0). (camera center)
From world point to camera-plane point Summary: Given coordinate Side view (we see only the edge of the image plane) representation ( x 1 , x 2 , x 3 ) in terms of a 1 , a 2 , a 3 , ◮ Have a point p in the world ◮ Express it in terms of a 1 , a 2 , a 3 coordinate representation of corresponding point in image ◮ Consider corresponding point q in image plane. plane is ( x 1 / x 3 , x 2 / x 3 , x 3 / x 3 ). ◮ Similar triangles ⇒ coordinates of q I call this scaling down . x 3 a 3 a 3 a 2 x 2 a origin origin p has coordinates coordi (x 1 , x 2 , x 3 ) (x image plane image plane p p
Converting to pixel coordinates Converting from a point ( x 1 , x 2 , x 3 ) in the image plane to pixel coordinates ◮ Drop third entry x 3 (it is always equal to 1) q q has coordinates (2.7, 4.5, 1) q is located in pixel (2, 4)
From world coordinates to camera coordinates to pixel coordinates Write basis vectors of camera coordinate system using world coordinates For each point p in the wire-frame cube, ◮ find representation in a 1 , a 2 , a 3 ◮ scale down to get corresponding point in image plane ◮ convert to pixel coordinates by dropping third entry x 3
Recommend
More recommend