user1142353
user1142353

Reputation: 51

Actual size of an object from its image

I would like to calculate the actual size of an object from its image taken at a fixed distance from the Camera. The focal length of the camera is known. Now how will I able to calculate the actual size of the object only with the image data??

I am implementing the program using Opencv.

Thanks in advance.

PS: I am little confused with this pixels and centimeter conversions.

Upvotes: 2

Views: 3465

Answers (2)

Liam M
Liam M

Reputation: 5432

This question on the photography exchange may prove useful reading:

https://photo.stackexchange.com/questions/12434/how-do-i-calculate-the-distance-of-an-object-in-a-photo

The top answer provides a general purpose equation easily manipulated for your purposes, and gives an excellent, detailed coverage. Best of luck :).

Upvotes: 1

sje397
sje397

Reputation: 41812

The size of the object to the distance from the camera is in the same ratio as the size of the image to the focal length.

So...

 s = is/fl * d

where s is the size of the object, is is the size of the object in the image, fl is the focal length, and d is distance to the camera.

Upvotes: 2

Related Questions