Reputation: 51
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
Reputation: 5432
This question on the photography exchange may prove useful reading:
The top answer provides a general purpose equation easily manipulated for your purposes, and gives an excellent, detailed coverage. Best of luck :).
Upvotes: 1
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