0
$\begingroup$

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.

1 Answers 1

1

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.