Ask Your Question

Revision history [back]

It depends on used projection matrices to call the function.

Where to look for projection matrices?

As OpenCV documentation suggests you can use stereoRectify() which needs results from calibrateCamera and stereoCalibration. As far as I know, it chooses new coordinate system which has an origin between the cameras.

Another way to get projection matrices is to compute it by yourself. Let's assume that first camera position creates your world coordinate system. Projection matrix could be computed as A * [R | T], where A is a instristic matrix for the camera and R is rotation vector and T translation vector. So for the first position you set as rotation matrix identity and as a translation vector [0,0,0,1]T. For the second projection matrix use the output of R, T from the stereoCalibrate.

I am working on locating an object in stereo vision, so far this approach gives me reasonable results. Please let me know if there is somewhere a problem.

Also I recommend to take a look at this question at StackOverflow