# opencv measure objects by pixels

I am trying to calculate the length and width of objects using a camera. The camera (90° angle from the top) and the background is fixed.

As an example I take a picture from a US quarter from a distance of 10 inches. To calibrate I calculate how many pixels the US quarter has. When I stack 25 quarters will I still be able to get an accurate measurement or is this not possible?

Also would it work any better if I have an image from the top and one from the front?

I appreciate any help :)

• I don't understand your question but, if it's "How do I implement this in some particular library", that's off-topic, here. Obviousy, if you measure the "total" diameter of 25 coins and divide by 25, you'll get a better estimate of the diameter. Or are you asking about the case where coins are stacked one on top of another so the top coin is closer to the camera and appears bigger? In what context are you trying to do this? If it's just a one-off measurement, make the measurement by whatever method works. If it's part of some system, you'll need to tell us more about it. – David Richerby Jan 16 '18 at 13:51
• But, probably, your question boils down to "how can I tell the relative sizes of objects in a photograph" and that's almost certainly much too broad for a Stack Exchange question. For example, without knowledge of what coins actually look like and/or a way of inferring distance, there's no way you can tell the difference between a big coin far from the camera and a small coin close to it. – David Richerby Jan 16 '18 at 13:52
• This question is impossible to answer without knowing more about your camera and calibration regime. Is your lens object telecentric? Are you performing a 3rd order distortion characterization, a spherical scale offset or simply measuring magnification? – PhotoScientist Feb 23 '18 at 15:08