How do I reverse-project 2D points into 3D?

后端 未结 13 1566
半阙折子戏
半阙折子戏 2020-11-28 18:25

I have 4 2D points in screen-space, and I need to reverse-project them back into 3D space. I know that each of the 4 points is a corner of a 3D-rotated rigid rectangle, and

13条回答
  •  星月不相逢
    2020-11-28 18:52

    Yes, Monte Carlo works, but I found better solution for this issue. This code works perfectly (and uses OpenCV):

    Cv2.CalibrateCamera(new List>() { points3d }, new List>() { points2d }, new Size(height, width), cameraMatrix, distCoefs, out rvecs, out tvecs, CalibrationFlags.ZeroTangentDist | CalibrationFlags.FixK1 | CalibrationFlags.FixK2 | CalibrationFlags.FixK3);
    

    This function takes known 3d and 2d points, size of screen and returns rotation (rvecs[0]), translation (tvecs[0]) and matrix of intrinsics values of camera. It's everything you need.

提交回复
热议问题