OpenCV contains a lot of support for 3D reconstruction from stereo cameras. In my case i have two cameras, and I want to know 3D coordinates of some point.
What i have:
What I want to get: Coordinates this point in 3D
I have answered the same question in this other post.
If you have extrinsic parameters, then you have the camera pose. With the camera pose and the the 2D point, you can proyect the 3D points (for each camera should be the same result if your 2D points and extrinsics are correct). You just need to convert pose to homography. I explain it in the post I linked.
Good luck!
I don't know if opencv has a construct for this. However I know you can use the law of sines for Angle-Side-Angle to construct the linear distance horizontally-parallel to the cameras using the inside angles of the point->camera->other camera as your reference points.
Then once you get the distance, you can calculate the vertical positioning by using the same construct: where the angle is counted from dead center to how far above or below the point is in reference to either camera, the distance to the object found in first step, and you can use 90 deg as your angle between that imaginary point (above object horizontal to the camera) and the object.
When you have no experience in triangulating points from two views you should the book of Hartley and Zisserman's book. In this book a linear triangulation method is described that is very easy to implement having the 2D point correspondences, the camera pose and the camera calibration.
Example code of this method is given here. It is based on the book mentioned above.
Nevertheless, there are very important conditions that have to be met. First, the measured point correspondences have to be correct with respect to the epipolar constraint x*E*x' = 0
. Second, the angle between the rays should be greater than a few degrees, e.g., 2 degrees.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With