Ask Your Question
0

How to derive relative R and T from camera extrinsics

asked 2016-03-11 22:08:20 -0600

adrienc gravatar image

Hi,

I have an array of cameras capturing a scene. They are precalibrated and their coordinates are stored as translation from scene origin, and 3 Euler angles describing the camera's orientation.

I need to supply stereoRectify() the relative translation and rotation of the second camera with respect to the first camera. I have found several contradictory definitions of R and T, none of which seem to give me a correct rectified image (epipolar lines are not horizontal).

With trial and error, the following (still probably incorrect) is the closest I've been able to get:

R = R1 * R2T

T = RT * ( T1 - T2 )

Where R1 and R2 are 3x3 rotation matrices formed from the Euler angles, and T1 and T2 are translation vectors from the scene origin. R and T are then sent to stereoRectify() once R has been converted to axis-angle notation with Rodrigues().

I have also tried R = R2 * R1T with T = R1 * ( T2 - T1 ), along with a few other permutations. All incorrect.

If I could get the real way to obtain R and T from world-space, that would help immensely with identifying the source of the incorrect outputs I'm getting.

I have taken into account the z-foward and -y up coordinate system of OpenCV. I have also rendered a pair of CGI images to verify that incorrect calibration was not the issue. (My goal is to compute the disparity map between each camera (taken as pairs), in order to later perform derive depth maps and perform image-based view synthesis.)

Thanks a million!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-03-12 07:37:46 -0600

Eduardo gravatar image

Try this:

  • For each camera, you have the corresponding homogeneous transformation matrix between each camera frame and the world frame: image description
  • It means that you can convert a coordinate in the camera frame to a coordinate in the world frame: image description

If you want to get the homogeneous transformation matrix between camera1 and camera2 image description:

image description

With: image description

And: image description

Also, the product of two homogeneous transformation matrices is:

image description

What you want should be:

image description

image description

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-03-11 22:08:20 -0600

Seen: 1,498 times

Last updated: Mar 12 '16