# Determine scale factor of an object given its distance from a viewer/camera

I have a 3d object which in its simplest form consists 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 very appreciated.

-
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. maven.smith.edu/~jhenle/Files/camera.pdf –  anon Dec 9 '10 at 8:09