Search code examples
matlabcomputer-visioncoordinate-systemscamera-calibrationmatlab-cvst

Creating stereoParameters class in Matlab: what coordinate system should be used for relative camera rotation parameter?


stereoParameters takes two extrinsic parameters: RotationOfCamera2 and TranslationOfCamera2.

The problem is that the documentation is a not very detailed about what RotationOfCamera2 really means, it only says: Rotation of camera 2 relative to camera 1, specified as a 3-by-3 matrix.

What is the coordinate system in this case ?

A rotation matrix can be specified in any coordinate system.

What does it exactly mean "the coordinate system of Camera 1" ? What are its x,y,z axes ?

In other words, if I calculate the Essential Matrix, how can I get the corresponding RotationOfCamera2 and TranslationOfCamera2 from the Essential Matrix ?


Solution

  • RotationOfCamera2 and TranslationOfCamera2 describe the transformation from camera1's coordinates into camera2's coordinates. A camera's coordinate system has its origin at the camera's optical center. Its X and Y-axes are in the image plane, and its Z-axis points out along the optical axis.

    enter image description here

    Equivalently, the extrinsics of camera 1 are identity rotation and zero translation, while the extrinsics of camera 2 are RotationOfCamera2 and TranslationOfCamera2.

    If you have the Essential matrix, you can decompose it into the rotation and a translation. Two things to keep in mind. First, the translation is up to scale, so t will be a unit vector. Second, the rotation matrix will be a transpose of what you get from estimateCameraParameters, because of the difference in the vector-matrix multiplication conventions.

    Out of curiosity, what is it that you are trying to accomplish? Are you working with a single moving camera? Otherwise, why not use the Stereo Camera Calibrator app to calibrate your cameras, and get rotation and translation for free?