|
Distance from camera using Kinect depth sensor Giedrius from Lithuania [2 posts] |
10 year
|
Hello,
I have attached the image of My red ball detection program. It outputs X and Y coordinates. I would like to add the distance from camera based on measurements from Microsoft Kinect depth camera.
Any suggestions on how I can accomplish that?
|
|
|
Steven Gentner from United States [1446 posts] |
10 year
|
Assuming you have the Kinect running, you would use the output of the red color detection to mask that area in the depth image. Then you can run the color stats to get an average pixel intensity in the depth image (with only the red object being active). That would give you the average distance to the object in terms of intensity.
If you post both the rgb and depth image we can reply back with an example robofile that would do that.
Note, since you use a ball of known size, you can also calculate distance based on the size of the ball using just an RGB image. I.e. number of red pixels detected correlates to the distance of the ball from the camera. This is another approach that doesn't require a Kinect ... but would only work with known objects.
STeven.
|
|