Say I've got a photograph of a scene, and measurements for part of it (eg. a room where I know the dimensions of the walls). Assuming a rectilinear lens, how would I go about setting up a virtual camera so that 3D objects are rendered as if they were in the physical scene?


This is the Camera re-sectioning problem.

We need to have a few points, like the end points of the walls, to take the roles of xw, yw and zw in the following equation:

enter image description here

Here A is defined as:

enter image description here

These are the values of the camera itself.

R and T are defined as the Rotation and Translation matrices for the camera, and are the values we need to solve for. The position, C, of the camera expressed in world coordinates is C = -R-1T = -RT T .

The linked Wikipedia article mentions a few algorithms to solve these equations.

An example of a practical application of these is also found on Math Stack Exchange.

Another example, with some code samples that you may want to use, is found Stack Overflow.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.