Finding the actual size of an object using kinect depth data

I was wondering how I can determine the actual size of an object using the kinect depth values.

For example, if the kinect sees a round object in front of it, and the round object occupies 100 pixels of space in the image, and the depth value that kinect gives is x, how would I know the actual size of the round object?

I don't need this in units like meters or whatever, I'm just trying to find a formula to calculate the size of an object that doesn't depend on how far the object is from the kinect.

I am using OpenCV and kinect SDK, if anything is helpful please let me know.

Thanks in advance.


source to share

1 answer

To find the size in 3d given the size in 2d, you simply do:

3d_rad = 2d_rad * depth


So, if the ball appears 10 pixels wide on the screen and is 1 meter away, it is indeed 10 inches wide. Play a little to see what the units returned, I'm not sure what they will.

Suppose there is a ball on the screen with a radius of 20 pixels, and the depth is returned as 30, the actual size of the ball is 20 * 30 = 600 units. Again, I'm not sure which unit is exactly, it depends on the camera, but it is constant, so play with it. Place the ball 1 meter in front of the camera, far enough away that it looks like 100 pixels. The reciprocal of this distance must be a conversion factor to convert the units you have to centimeters and can be used as a constant. For example:

3d_rad_in_cm = conversion * 2d_rad * depth




All Articles