Reputation: 536
I have a single image and several known points and its projections to image plane. (each 3d point has projection to 2d). My goal is to find matrix 4x4, for easy calculation of projection of any 3d point to image plane. I tried to use Monte-Carlo method from this topic: How do I reverse-project 2D points into 3D? But result matrix is good for oXY plane, not for Z coordinate (points with non-zero Z are projected incorrectly). Also I used OpenCV.CalibrateCamera method. I got rotation matrix, camera matrix and translation vector, but it isn't good for non-zero Z points too. In addition, I am not interested in 3 matrices, I just want to get one matrix 4x4 for projecting and unprojecting points.
I'm pretty sure that my problem has solution, but doesn't know how.
Upvotes: 7
Views: 6131
Reputation: 536
Finally, I found the solution. It is described in http://ece.ucsb.edu/~manj/ece181bS04/ECE_181b_HW3/camera_matrix_key.pdf The method has the name "Direct linear calibration" and requires at least 6 points in 3d and its projections to the image plane. The method returns camera matrix 4*3, which I did try to find.
Update: I even created npm package projection-3d-2d to help others with this problem. Package calculates 3x3 and 4x4 matrices for projection 2D to 2D and 3D to 3D accordingly. Read more
Upvotes: 2