In computer vision a camera matrix or (camera) projection matrix is a matrix which describes the mapping of a pinhole camera from 3D points in the world to 2D points in an image. Let be a representation of a 3D point in homogeneous coordinates (a 4-dimensional vector), and let be a representation of the image of this point in the pinhole camera (a 3-dimensional vector). Then the following relation holds where is the camera matrix and the sign implies that the left and right hand sides are equal except for a multiplication by a non-zero scalar : Since the camera matrix is involved in the mapping between elements of two projective spaces, it too can be regarded as a projective element. This means that it has only 11 degrees of freedom since any multiplication by a non-zero scalar results in an equivalent camera matrix. Derivation The mapping from the coordinates of a 3D point P to the 2D image coordinates of the point's projection onto the image plane, according to the pinhole camera model, is given by where are the 3D coordinates of P relative to a camera centered coordinate system, are the resulting image coordinates, and f is the camera's focal length for which we assume f > 0. Furthermore, we also assume that x3 > 0. To derive the camera matrix, the expression above is rewritten in terms of homogeneous coordinates. Instead of the 2D vector we consider the projective element (a 3D vector) and instead of equality we consider equality up to scaling by a non-zero number, denoted . First, we write the homogeneous image coordinates as expressions in the usual 3D coordinates. Finally, also the 3D coordinates are expressed in a homogeneous representation and this is how the camera matrix appears: or where is the camera matrix, which here is given by , and the corresponding camera matrix now becomes The last step is a consequence of itself being a projective element. The camera matrix derived here may appear trivial in the sense that it contains very few non-zero elements. This depends to a large extent on the particular coordinate systems which have been chosen for the 3D and 2D points. In practice, however, other forms of camera matrices are common, as will be shown below. Camera position The camera matrix derived in the previous section has a null space which is spanned by the vector