Triangulate Points from Stereo Image

asked 2016-09-21 07:15:31 -0500

TiBe gravatar image

updated 2016-09-21 07:16:43 -0500

Hello guys,

I hope someone can help me with my problem :)

That's my approach

I have two cameras and now I want to calculate the 3D coordinates of an object. For this, I calibrate the cameras individually and then I use stereoCalibrate.

Now I have the intrinsic and extrinsic parameters and would like to triangulate. To do that, I create the projection Matrices like this.

Basically one camera I can keep as P1= K1 [I|0] (identity rotation and 0 translation), and the other camera P2= K2*[R|t] (rotation and translation between the cameras from stereoCalibrate())

These matrices I hand over to the triangulate function (

To test the triangulation

Checkerboard: 9x6 and 12 mm per square

I use the reference checkerboard images because the depth should be constant but i have depth "linear". The x and y coordinates are accurate over the entire distance to 0.2mm.

The picture shows the values for the first two rows. As you can see the depth is strange

image description

Anyone know where is my problem? Thanks.

edit retag flag offensive close merge delete


Not sure to understand fully.

What are you printing (3D coordinates but according to which frame?)? You should post the image you used.

In my opinion, except if the checkboard is perfectly parallel to the image plane, you will have a variation on the z coordinate as the frame reference should be the frame of the left camera.

Eduardo gravatar imageEduardo ( 2016-09-21 09:02:12 -0500 )edit

Short excursion

My stereosystem consists of vertical parallel-aligned cameras.

I calibrate the cameras with several chessboard images from various positions (load the images from desktop) and create the 3D points of my chessboard in its own coordinate system as follow

vector<Point3f>  obj;
for (int j = 0; j<sChess.board_n; j++)
    obj.push_back(Point3f(0.02377*(j % sChess.board_w), 0.02377*(j / sChess.board_w), 0));  

Now I use the last image pair to check the triangulation.

Image Camera up

Image Camera down

According to my understanding, after triangulation the depth must be constant, respectively the distance from camera to Chessboard.

TiBe gravatar imageTiBe ( 2016-09-22 00:18:52 -0500 )edit

What is the unit? It seems like the Z coordinates are more or less constant if the unit is mm. The variation could be due to the fact that the chessboard are not exactly parallel to the image plane?

Eduardo gravatar imageEduardo ( 2016-09-23 03:53:10 -0500 )edit

The unit is in mm. I need an accuracy of 0,5mm. Yes, it's possible that the chessboard are not exactly parallel to the image plane but what I have to change then, so that the values are constant?

If I use the projection matrices from stereo rectify, all of my values are bad

TiBe gravatar imageTiBe ( 2016-09-23 04:14:16 -0500 )edit

In my opinion, you need to find a way to place the chessboard the most possible parallel to the stereo rig. I think I have seen some people using a robotic arm to do that.

Also, I am not sure if an accuracy of 0.5 mm is feasible on a regular configuration: you have to check the equations but depth range and precision should depend on the baseline and the image resolution (and also on the stereo reconstruction algorithm).

Eduardo gravatar imageEduardo ( 2016-09-23 07:20:15 -0500 )edit