# How to calculate the transformation from the pivot point to each stereo camera

I checked the API documentation and this related question, and it looks like there is no easy way to get the pose of both the left-stereo and right-stereo cameras. So, I think the only solution is to calculate the transformation by ourselves. I will propose a solution myself but feel free to add your own to the answers if you know a better/simpler way.

Assuming that Stereoscopy in ON (bpy.context.scene.render.use_multiview = True). No matter how you change the stereoscopy parameters (Mode, Interocular Distance, Pivot, ...), the world_coordinates of the camera are always the same, which can be obtained using C.scene.camera.matrix_world. So my first question was what is camera.matrix_world pose representing in a stereo setup?

A: I made some tests and I found that it always corresponds to the pose of the Pivot point. So if Pivot = Left it corresponds to the left camera, Pivot = Right to the right camera, and Pivot = Centre it corresponds to neither of the cameras, but the point in the middle!

For simplification, I will assume that we only care about the Pivot = Left scenario. Also, here I will assume that we are using the computer vision axis, with the Z outwards the camera. Since I am in the Pivot = Left scenario, I can convert the C.scene.camera.matrix_world into the extrinsic of the Left camera (using @rfabbri method). Note that if we were in the scenario of Pivot = Centre, we would need to calculate two transformations, from pivot to left-stereo and from pivot to right-stereo.

## Pivot = Left

Stereo mode 1 - Parallel

In this mode, it is easy to calculate the transformation, since it corresponds to a single translation that depends on the stereo.interocular_distance.

Stereo mode 2 - Toe-in

In this mode, in addition to the interocular_distance we rotate the non-pivot cameras, in this case, the right camera only. What I imagined it would be something like in the image below. However, I made a test, with a small sphere 10 [m] away from the pivot (in this case the left camera), with a convergence_distance = 10 [m] and interocular_distance = 10 [m]. With these values the centre of the sphere does not align on the two stereo images, so the set-up below is wrong.

Experiment:

Stereo mode 3 - Off-Axis

The off-axis currently I don't understand how it works. I think here it is not only a geometrical transformation, but they also change the intrinsic matrix of the non-pivot camera, since they mention shifts in the documentation.

Does anyone understand how the Toe-in or Off-Axis work in Blender? Specifically, I am interested in their geometric models.