Determining camera location from 3 known points

3.4k views Asked by At

I'm new here - so please bear with me if I make a faux pas!

My question is, is there a good algorithm for determining the 3d location and orientation of a camera based on where 3 (or more) known 3d points end up on an image as viewed from that camera?

The question comes down, in my calculation to 6 equations, with 6 unknowns, though I'm looking for a general solution, and the equations are complicated and trigonometric.

Any ideas gratefully recieved!

Cheers,

Mike

6

There are 6 answers

2
jghost On

If you think about it... it's actually a somewhat simple idea... here's my train of thought:

  1. Find the plane that the 3 points sit on. This plane will be parallel to your projection plane.
    1. Assuming that you have point A, B and C. Find the cross product of the vector going from A to B and A to C
    2. Normalize it. That's your plane's normal.
    3. Solve for the barycentric equation by plugging in values for Ax + By + Cz + D = 0 where A is the x of the normal, B is y of the normal, C is the z of the normal and you solve for D. Once you have D, you have the plane's representation.
  2. Find a bounding rectangle around all three points on that plane, this will be your rendering geometry, the end of your frustum (rendering volume).
  3. Find the center point of that bounding rectangle we just found. This is your initial center of projection.
  4. Move that center point away from the bounding rectangle by adding (or subtracting) the normal from the point. Keep moving until you have reached the desired field of view.
1
Beta On

In general I think there will not be a unique solution.

You can seperate it into two problems of three unknowns each: position and orientation. First assume that the camera does not introduce unknown distortions (f'rinstance by projecting the sphere onto a flat piece of film). Disregard orientation for a minute and what you are measuring is angular seperation between the objects. From here on I will assume that there are only three points and that you can distinguish them-- they're different colors or something. Measuring the angle between two known points puts you on a 2-dimensional surface in space (I can't plot up graphics easily, but they look sort of like electric field lines). Adding another point will put you on another, intersecting surface; there is lots of degeneracy and it's not obvious that the equations have a clean exact solution.

It's worth noting that every pair you look at imposes volume constraint, so it might be useful to look at the most obtuse angles first and put some bounds on where the camera can be.

If you can determine position, then orientation is easy, and requires only two (non-eclipsing) points.

5
Martin Beckett On

With a calibrated camera - yes.
All you need is the focal length (maps pixels into angles) the center axis of the camera (puts a ray into your scene) and then projecting a point on that ray is simple.

Take a look at OpenCV, it does this as par tof the camera calibration for stereo

alt text http://img.amazon.ca/images/I/41Ob1y3baeL._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA240_SH20_OU15_.jpg

0
Matthew Whited On

Is this a virtual camera or a real camera? You will also need to look as f/stop and focal length and possibly even the shape of the optics. It really depends on how accurate you need to be for the position and how far apart the objects that were photographed are from each other. If you are using a 200mm zoom with a focus of only a few feet your field of view may only be a few inches across. Yet if you use a 4.5mm full circle fisheye you and have direct circular projection you may have 180 degrees of view.

3
ibraheem z On

you should use ransac Algorithm ! you should have a refernce photo that you know its location from the camera in xyz then you should compare the new image to the refernce image by ransac .you can then find the offset between the two photos , then add it to xyz refernce

0
mouviciel On

With more than three points, it is certainly possible.

This is the way star trackers work for controlling spacecraft attitude.