OpenCV中摄像机坐标系定义-存档用的奥
The functions in this section use the so-called pinhole camera model. That is, a scene view is formed by projecting 3D points into the image plane using a perspective transformation.
or
Where are the coordinates of a 3D point in the world coordinate space,
are the coordinates of the projection point in pixels.
is called a camera matrix, or a matrix of intrinsic parameters.
is a principal point (that is usually at the image center), and
are the focal lengths expressed in pixel-related units. Thus, if an image from camera is scaled by some factor, all of these parameters should be scaled (multiplied/divided, respectively) by the same factor. The matrix of intrinsic parameters does not depend on the scene viewed and, once estimated, can be re-used (as long as the focal length is fixed (in case of zoom lens)). The joint rotation-translation matrix
is called a matrix of extrinsic parameters. It is used to describe the camera motion around a static scene, or vice versa, rigid motion of an object in front of still camera. That is,
translates coordinates of a point
to some coordinate system, fixed with respect to the camera. The transformation above is equivalent to the following (when
):
Real lenses usually have some distortion, mostly radial distorion and slight tangential distortion. So, the above model is extended as:
,
,
are radial distortion coefficients,
,
are tangential distortion coefficients. Higher-order coefficients are not considered in OpenCV. In the functions below the coefficients are passed or returned as
vector. That is, if the vector contains 4 elements, it means that . The distortion coefficients do not depend on the scene viewed, thus they also belong to the intrinsic camera parameters. And they remain the same regardless of the captured image resolution. That is, if, for example, a camera has been calibrated on images of
resolution, absolutely the same distortion coefficients can be used for images of
resolution from the same camera (while
,
,
and
need to be scaled appropriately).
The functions below use the above model to
- Project 3D points to the image plane given intrinsic and extrinsic parameters
- Compute extrinsic parameters given intrinsic parameters, a few 3D points and their projections.
- Estimate intrinsic and extrinsic camera parameters from several views of a known calibration pattern (i.e. every view is described by several 3D-2D point correspodences).
- Estimate the relative position and orientation of the stereo camera “heads” and compute the rectification transformation that makes the camera optical axes parallel.