Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 3D object which is in its simplest form consisting of an origin in 3D space and a set of vertices that are all local to this origin.

I then transform this 3D origin into 2D camera coordinates using a perspective transform, but I need some way to also transform the local vertices of this object which has the effect of moving this 3D object from 3D world coordinates into 3D camera coordinates.

How can I determine the scale of an object based on it's distance from the viewer/camera?

I hope this makes sense, the title is probably the most concise explanation I can give. Any help would be much appreciated.

share|cite|improve this question
I do not understand the question, so this is probably nonsense. Think of a triangle with apex at the camera, base stretched out to your object, a distance $d_o$ away. Suppose your 2D image plane is $d_i$ away. Then the object is scaled by a factor of $d_i/d_o$, just by similar triangles. – Joseph O'Rourke Dec 8 '10 at 19:26
That is helpful thanks, I would love to post a picture which would describe it better but I don't have enough reputation :/ – tbridge Dec 8 '10 at 21:34
"into 2d camera coordinates", surely? I don't understand the question--- I don't know what "the scale" of an object is, or how to determine it. But this sounds like the basic and fundamental question of 3d graphics--- given a 3d representation of a point, and info about where the camera and viewing plane is, determine planar coordinates of the point. This is a basic problem in 3D graphics and well documented on the web. Sometimes the map taking the 3d things to the 2d things is called a "perspective transformation" or perspective projection. Googling on this topic might help. – anon Dec 9 '10 at 1:43
@anon you misunderstand, i appreciate the help and i realize this is a poor explanation but my problem is not transforming a 3d point into 2d coordinates. I wish i could explain it better but without images its tough, trust me i've googled it for hours :) – tbridge Dec 9 '10 at 2:24
This may be completely unrelated, but it's a fun paper and you might like it anyway. It explains one way to determine, from measurements on a photo and basic assumptions (e.g. about parallel lines in the photo), where the camera was. – anon Dec 9 '10 at 8:09

This is an interesting optics/physics/math problem. I believe that your question could be asking for a number of distinct answers:

  1. Scale in image space is determined according to the magnification of the camera:

  2. Calculate the distance from the 'lens' to the image using the distance from the object to the image, information about the camera, and lens equations - note that complicated optical systems can be represented by a single lens with a defined focal length. (Also, note that the focal length may vary as the camera is focused.) This is most easily accomplished for the pinhole camera, for which the distance from the 'lens' (the pinhole) to the image is defined entirely by the placement of a surface behind the pinhole. More complicated cameras can be translated into a pinhole camera for the purposes of performing a raytrace. To calculate the 'scale' of features, project each of the vertices through the pinhole and calculate their intersections with the image surface - when using a simplified representation of a camera, this will be a plane a defined distance beyond the pinhole, but a rotated image can be calculated by placing the plane between the object and the pinhole.

  3. Finally, it is possible to image each of the vertices through an optical system individually, taking into account the depth of the scene to account for depth of the image, but typically image sensors are planar and this type of analysis is only useful for depth-of-field type calculations. I recommend #1 or #2 unless there is a compelling reason to do this.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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