OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Fri, 23 Sep 2016 07:20:15 -0500Triangulate Points from Stereo Imagehttp://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/ 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 (http://www.morethantechnical.com/2012/01/04/simple-triangulation-with-opencv-from-harley-zisserman-w-code/)
**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](/upfiles/14744601134612977.png)
Anyone know where is my problem?
Thanks.Wed, 21 Sep 2016 07:15:31 -0500http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/Comment by Eduardo for <p>Hello guys,</p>
<p>I hope someone can help me with my problem :) </p>
<p><strong>That's my approach</strong></p>
<p>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.</p>
<p>Now I have the intrinsic and extrinsic parameters and would like to triangulate.
To do that, I create the projection Matrices like this.</p>
<p>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())</p>
<p>These matrices I hand over to the triangulate function (<a href="http://www.morethantechnical.com/2012/01/04/simple-triangulation-with-opencv-from-harley-zisserman-w-code/">http://www.morethantechnical.com/2012...</a>)</p>
<p><strong>To test the triangulation</strong></p>
<p>Checkerboard: 9x6 and 12 mm per square</p>
<p>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.</p>
<p>The picture shows the values for the first two rows. As you can see the depth is strange</p>
<p><img alt="image description" src="/upfiles/14744601134612977.png"/></p>
<p>Anyone know where is my problem?
Thanks.</p>
http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/?comment=102858#post-id-102858In 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).Fri, 23 Sep 2016 07:20:15 -0500http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/?comment=102858#post-id-102858Comment by TiBe for <p>Hello guys,</p>
<p>I hope someone can help me with my problem :) </p>
<p><strong>That's my approach</strong></p>
<p>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.</p>
<p>Now I have the intrinsic and extrinsic parameters and would like to triangulate.
To do that, I create the projection Matrices like this.</p>
<p>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())</p>
<p>These matrices I hand over to the triangulate function (<a href="http://www.morethantechnical.com/2012/01/04/simple-triangulation-with-opencv-from-harley-zisserman-w-code/">http://www.morethantechnical.com/2012...</a>)</p>
<p><strong>To test the triangulation</strong></p>
<p>Checkerboard: 9x6 and 12 mm per square</p>
<p>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.</p>
<p>The picture shows the values for the first two rows. As you can see the depth is strange</p>
<p><img alt="image description" src="/upfiles/14744601134612977.png"/></p>
<p>Anyone know where is my problem?
Thanks.</p>
http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/?comment=102850#post-id-102850The 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 badFri, 23 Sep 2016 04:14:16 -0500http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/?comment=102850#post-id-102850Comment by Eduardo for <p>Hello guys,</p>
<p>I hope someone can help me with my problem :) </p>
<p><strong>That's my approach</strong></p>
<p>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.</p>
<p>Now I have the intrinsic and extrinsic parameters and would like to triangulate.
To do that, I create the projection Matrices like this.</p>
<p>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())</p>
<p>These matrices I hand over to the triangulate function (<a href="http://www.morethantechnical.com/2012/01/04/simple-triangulation-with-opencv-from-harley-zisserman-w-code/">http://www.morethantechnical.com/2012...</a>)</p>
<p><strong>To test the triangulation</strong></p>
<p>Checkerboard: 9x6 and 12 mm per square</p>
<p>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.</p>
<p>The picture shows the values for the first two rows. As you can see the depth is strange</p>
<p><img alt="image description" src="/upfiles/14744601134612977.png"/></p>
<p>Anyone know where is my problem?
Thanks.</p>
http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/?comment=102849#post-id-102849What 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?Fri, 23 Sep 2016 03:53:10 -0500http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/?comment=102849#post-id-102849Comment by TiBe for <p>Hello guys,</p>
<p>I hope someone can help me with my problem :) </p>
<p><strong>That's my approach</strong></p>
<p>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.</p>
<p>Now I have the intrinsic and extrinsic parameters and would like to triangulate.
To do that, I create the projection Matrices like this.</p>
<p>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())</p>
<p>These matrices I hand over to the triangulate function (<a href="http://www.morethantechnical.com/2012/01/04/simple-triangulation-with-opencv-from-harley-zisserman-w-code/">http://www.morethantechnical.com/2012...</a>)</p>
<p><strong>To test the triangulation</strong></p>
<p>Checkerboard: 9x6 and 12 mm per square</p>
<p>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.</p>
<p>The picture shows the values for the first two rows. As you can see the depth is strange</p>
<p><img alt="image description" src="/upfiles/14744601134612977.png"/></p>
<p>Anyone know where is my problem?
Thanks.</p>
http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/?comment=102760#post-id-102760Short 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
https://picload.org/image/rdrlldgd/measureimage_up.jpg
Image Camera down
https://picload.org/image/rdrlldgg/measureimage_down.jpg
According to my understanding, after triangulation the depth must be constant,
respectively the distance from camera to Chessboard.Thu, 22 Sep 2016 00:18:52 -0500http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/?comment=102760#post-id-102760Comment by Eduardo for <p>Hello guys,</p>
<p>I hope someone can help me with my problem :) </p>
<p><strong>That's my approach</strong></p>
<p>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.</p>
<p>Now I have the intrinsic and extrinsic parameters and would like to triangulate.
To do that, I create the projection Matrices like this.</p>
<p>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())</p>
<p>These matrices I hand over to the triangulate function (<a href="http://www.morethantechnical.com/2012/01/04/simple-triangulation-with-opencv-from-harley-zisserman-w-code/">http://www.morethantechnical.com/2012...</a>)</p>
<p><strong>To test the triangulation</strong></p>
<p>Checkerboard: 9x6 and 12 mm per square</p>
<p>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.</p>
<p>The picture shows the values for the first two rows. As you can see the depth is strange</p>
<p><img alt="image description" src="/upfiles/14744601134612977.png"/></p>
<p>Anyone know where is my problem?
Thanks.</p>
http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/?comment=102724#post-id-102724Not 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.Wed, 21 Sep 2016 09:02:12 -0500http://answers.opencv.org/question/102712/triangulate-points-from-stereo-image/?comment=102724#post-id-102724