We want to project a camera image of a three-dimensional structure onto a CAD model of this structure in perspective to recover the depth information. The spatial position of the camera and the camera axis in relation to the CAD model are exactly known. The question is, what is the mathematical approach to find the depth information of the two-dimensional image?
We have created an approach using the IGES toolbox in MATLAB, but we encounter problems in implementing our data in the exemplary code.
Is there a different approach or tool?
Thanks in advance for your answers.
When you render the CAD model as seen from the camera (in such a way that it perfectly registers with the real photo), the distance information is contained in the XYZ coordinates of the projected points and the position of the optical center of the camera.
Either your renderer is able to provide this information (which it uses internally), or you can implement a ray-tracing process that sends rays from the camera sensor to the model, until it hits the first surface.
If your renderer uses a Z-buffer, the latter contains the depth information, possibly transformed by an homography.