opencvcomputer-vision3d-reconstructionstructure-from-motion

How can I projects points from 2D to 3D using OpenCV?


I'm working on Camera Calibration and 3D Reconstruction problem.

Is there a method in OpenCV or any other Python package that projects points from 2D to 3D given

  1. R - a rotation matrix,
  2. T - a translation matrix,
  3. focal length (f_x, f_y) and optical centers (c_x, c_y).

Solution

  • As you are not doing stereo, from a single 2D point and camera calibration, you cannot obtain a 3D point (at least no without additional constraints, for example that the point is at the ground level or something like that).

    What you can obtain from a single 2D point is a 3D ray (a 3D vector), in which the 3D point lies. Referring to the picture below, from [https://docs.opencv.org/2.4/_images/pinhole_camera_model.png]:

    enter image description here

    From (X, Y, Z) you can obtain (u, v), but any point in the red line will also project to the same (u, v). This implies that given (u, v), you cannot know which point along this line you are observing.