Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reconstruction a 3D point from two 2D points?

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:

  1. pixel coordinates of point on both images
  2. Known intrinsic and extrinsic camera parametres

What I want to get: Coordinates this point in 3D

like image 765
user1415976 Avatar asked May 24 '12 20:05

user1415976


3 Answers

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!

like image 174
Jav_Rock Avatar answered Nov 09 '22 08:11

Jav_Rock


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.

like image 32
phillk6751 Avatar answered Nov 09 '22 06:11

phillk6751


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.

like image 24
who9vy Avatar answered Nov 09 '22 06:11

who9vy