5
$\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 params 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 explaination/links/help would be highly appreciated.

$\endgroup$

2 Answers 2

2
$\begingroup$

Unfortunately you can't estimate the real size of an object from an image, since you do not know the distance of the object to the camera.

Geometric Camera Calibration gives you the ability to project a 3D world point onto your image but you can not project a 2D image point into the world without knowing its depth.

$\endgroup$
1
$\begingroup$

Even if you have object photographed at different depths, you still have to measure your distance of taking snapshots, and theoreticaly move along the line (at least try) for consecutive snapshots. Even better if you can take it from at least three positions.

Take a look: https://photo.stackexchange.com/questions/40981/what-is-the-relationship-between-size-of-object-with-distance

You have to calibrate camera: http://www.aishack.in/tutorials/calibrating-camera-theory/
Fix distortions: http://aishack.in/tutorials/major-physical-defects-cameras/ http://www.aishack.in/tutorials/calibrating-undistorting-opencv-oh-yeah/

Theoretically you can measure object from two pictures from different distances (in one line), but when it comes to combination of every possible distortion, shifts and so on, this is only rough estimate of 2D contour.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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