opencvcomputer-visionstereo-3d

What camera is chosen as the origin in cv2.stereoCalibrate?


I am trying to calibrate two stereo cameras, when I use cv.stereoCalibrate it gives me a 3 x 3 rotation matrix and a 1 x 3 translation vector. But I'm not sure which camera here is chosen as the origin. Essentially, does the translation vector describe the translation of Camera 1 from Camera 2 or Camera 2 from Camera 1. I feel the documentation is lacking in some details.

Documentation (Search 'stereoCalibrate')


Solution

  • The documentation says:

    R Output rotation matrix. Together with the translation vector T, this matrix brings points given in the first camera's coordinate system to points in the second camera's coordinate system. In more technical terms, the tuple of R and T performs a change of basis from the first camera's coordinate system to the second camera's coordinate system. Due to its duality, this tuple is equivalent to the position of the first camera with respect to the second camera coordinate system.

    In other words, the output (R, T) pair describes the coordinate transform such that, given a 3D point p and its decompositions p_1 in the coordinates of Camera 1, and p_2 in the coordinates of Camera 2, it is:

    p_2 = R * p_1 + T 
    

    The columns of R are, ordinately, the X, Y and Z unit vectors of the Camera 1 coordinate frame decomposed in Camera 2 frame, and T is the position of the center of Camera 1 expressed in Camera 2 coordinates.