1
$\begingroup$

I am quite new to vision and OpenCV, so forgive me if this is a stupid question but I have got really confused.

My aim is to detect an object in an image and estimate its actual size. Assume for now I only want length and width, not depth. Lets say I can detect the object, find its size(length and width) in pixels and I have both the intrinsic and extrinsic parameters of the camera.

The documentation of camera calibration as I understand says that the intrinsic and extrinsic camera parameters can be used to transform from camera coordinate system to world coordinate system. So this should mean converting from pixel coordinates to real coordinates right? And so I should be able to use pixel size and these parameters to find the real size?

But, say the object is photographed at different depth (distance from camera), then its size would come out different using above method. So.....what does it mean transforming from camera to world coordinates?

Any kind of explanation/links/help would be highly appreciated.

$\endgroup$
1
$\begingroup$

I really am no expert in cameras (nor in OpenCV in which I'm pretty sure everything can be handled automatically et efficiently without doing calculations yourself). But without knowing the distance between the lens and your object, that will be difficult.

Actually, knowing the focal length of your camera and the distance from the nodal point to the image plane, you can deduce the distance from the nodal point to the object. Then just use Thales' theorem and you can do exactly what you want.

The problem of this method is that it relies on how well the focus is done on the camera. And because of the varying depth of field of your camera, the magnitude of the error will vary too. AFAIK, this method should work pretty well for short distances. For longer ones, that can be very difficult as the focal point is near infinity and the depth of field is really large.

As an alternative, you can put an object of known size next to the object which size you are measuring. Thales' theorem again and you get your data.

$\endgroup$
  • $\begingroup$ I can put an object of known length close. What do you mean by nodal point? $\endgroup$ – Gaurav Fotedar Jul 14 '15 at 14:00
  • $\begingroup$ This is basic optics (don't take it as a negative critic, it's OK you don't know, but this is your problem, only you can eventually solve it). But since you can use an object on known length, that shouldn't matter. $\endgroup$ – user13706 Jul 14 '15 at 14:07
0
$\begingroup$

With a single calibrated camera you can determine the object's size if you know its distance from the camera. Conversely, you can determine the object's distance if you know its size.

If you do not know either the distance or the size, then you would need two calibrated cameras, and you would need to know the rotation and translation between them.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.