0

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).
James Larkin
  • 541
  • 5
  • 18
  • You're not explaining the problem you are trying to solve well. You have some 2D, flat images, and you want to extract a 3D point from them? How does that make sense? What exactly are you trying to find the location of, in what space? – BadZen Apr 16 '19 at 21:12
  • (for example, your method implies might be trying to do something like texture mapping a 2D image onto a 3d object... is that it?) – BadZen Apr 16 '19 at 21:14
  • I'm sorry if I was unclear, please see the presentation for the context first: http://www.connellybarnes.com/work/class/2017/intro_vision/06_linear_algebra.pptx – James Larkin Apr 16 '19 at 21:26
  • Computer vision huh? If you're trying to create a 3d model of the world from 2d stills taken of a 3d scene, ... ... that method isn't adequate and you're not ready to do it yet. Finish your class first. :p – BadZen Apr 16 '19 at 21:28
  • It's only 1 3D point actually. – James Larkin Apr 16 '19 at 21:29
  • After the camera calibration (using the matrices you mentioned) you need to follow https://docs.opencv.org/3.1.0/dd/d53/tutorial_py_depthmap.html – Dr.Haimovitz Apr 17 '19 at 05:22
  • @Dr.Haimovitz I'm confused, why would I need to build a stereo map if my goal is to project 2D points into 3D points? – James Larkin Apr 17 '19 at 06:25

1 Answers1

4

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.

Milo
  • 2,062
  • 16
  • 38