# Calculate distance, knowing actual and perceived size

What's equation would I use to calculate distance to an object, if I know it's actual and perceived size?

Say there is a line, and I know it's actual length is 65 (units), I perceive it as 62 (units).

I found various angular size equations on wikipedia and calculators like http://www.1728.org/angsize.htm however I don't know angle.

-
How do you mean, you perceive it as $62$ units? How do you determine this? –  joriki Aug 8 '12 at 13:00
Hi, that's not the full story but the intercept theorem (en.wikipedia.org/wiki/Intercept_theorem) might be of interest to you. –  Hauke Strasdat Aug 8 '12 at 13:07
@joriki Right now I'm talking about an image. I have hundred copies of same object (with flat side, which I'm calculating). Closest to camera is 65 pixels. Others vary depending on distance from camera. I know they all have same size, but I'm unaware about angle, or actual distance. –  David Sergey Aug 8 '12 at 13:43

Suppose objects $X$ and $Y$ appear to be the same size. $X$ is actually of size $s_X$ and at distance $d_X$, and $Y$ is actually of size $s_Y$ and at distance $d_Y$. Then:

$${s_X\over s_Y} = {d_X \over d_Y}$$

or equivalently:

$${d_X\over s_X} = {d_Y\over s_Y}$$

Any three of these will determine the fourth.

For example, a U.S. quarter dollar coin is about 2.5 cm in diameter. Held at a distance of 275 cm, it appears to just cover the full moon. We can conclude that the distance to the moon, divided by the diameter of the moon, is equal to about 275 cm / 2.5 cm = 110.

If we somehow know that the distance to the moon is around 385,000 km, then this tells us that the diameter of the moon is around 3500 km, or vice versa, but we cannot get either one without the other.

Similarly, we know from the existence of total solar eclipses that

$${d_☉\over s_☉} = {d_☾\over s_☾}$$

where ☉ is the sun and ☾ is the moon. So we know that ${d_☉\over s_☉}\approx 110$ also. Again, if we know that the distance to the sun is about $150·10^6$ km, we can conclude that the sun's diameter is about $1.36·10^6$ km, and if we know the diameter of the sun instead we can estimate its distance. But without one we can't get the other.

-
Proportional equation does not work for me, since I have 2 objects of a same size (actual size). So in my case it will look like: 65/65 = dx/dy or dx/65 = dy/65. Which implies that both distances are equal. I have two objects with a same size, say 2 same coins) and I need to calculate distance [between them] from perceived size. –  David Sergey Aug 8 '12 at 14:13
You can't; all you can do is calculate their relative distance. As in the first equation I wrote above, the ratio of the distances will be equal to the ratio of the perceived sizes. –  MJD Aug 8 '12 at 15:15
I see, I will have to look at this problem from different angle then. Thanks. –  David Sergey Aug 8 '12 at 15:21

If, as you wrote in a comment, what you call perceived lengths are lengths in pixels in images, then you can't know the distance just from the perceived and actual lengths -- imagine all the distances and all the image resolutions doubled; then all the lengths would be the same.

-