0
votes

I'm able to figure out how to produce the camera matrix for a set of stereo cameras without recitification. What I do is I call calibrateCamera twice, this gives me C1, R1 and T1 and C2, R2 and T2, for each camera.

I combine this to make the projection matrix P1 = C1 * [R1|T1], and P2 = C2 * [R2|C2]. This is a 3x4 matrix

I then have a correspondence algorithm of my own that produces a correspondence, and then I feed each of them triangulatePts to get a set of 3D points.

Now, I have the need to use stereo rectification prior to running my correspondence algorithm. I'm stuck as to how to get the projection matrix after doing stereo rectification. We seem to get two rotation matrices(let them be called, R*) and a new projection matrix (P*). How do I combine these now to get a new projection matrix (3x4 matrix) to feed into triangulatePts?

The sample seems to only address as to how to use these matrices and run initUndistorRectifyMap and remap, so that the images get aligned. It also gives me a disparity map, but I don't think I should use that as my sole purpose for doing this is to test a correspondence algorithm, which would result in a good disparity map.

EDIT: I assume no distortion is present in the cameras, which is mostly true in this case.

1

1 Answers

0
votes

The answer here is somewhat obvious, although it wasn't so at the time. The projection matrices I'm looking for was P1 and P2. This can be straight away used to work with triangulatePts.

My confusion was due to looking at how to construct the projection matrices with distortion parameters. Actually, this is not necessary, because the whole remap process undistorts the images, so that we can straight away make use P1 and P2 as the projection. Hope this helps someone.