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 am trying to write a program that can show the worth of a coin in an image.

I have already took care of finding radius of coins in pixel. But I am stuck here: if the image has been taken from a distance of h millimeters with angle of $90$ degrees, and lets say a coin in the image has radius of p pixels, how can I calculate the diameter of the coin ($d = p * 2$) in millimeters?

I just want to know the possible mathematical approach to solve this, the coding should be ok to do. Sorry if this question may not be related here.

share|cite|improve this question
up vote 1 down vote accepted

You need to know the view angle of the lens used to take the photo. For example, Wikipedia gives the vertical angle of view of a 50 mm lens on 35 mm film (or equivalent sized CCD) as $27^{\circ}$. If the full height of the image is P pixels then the image is $2h \sin \frac {27^{\circ}}2$ high and the coin is $\frac pP 2h \sin \frac {27^{\circ}}2$ in diameter. This assumes the image has not been cropped. For other size sensors, often the focal length is quoted as 35mm equivalent and you can use the same approach.

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.