hole detection from depth camera

asked 2021-04-27 07:38:30 -0500

felixN gravatar image


On my robot, I have a stereo camera (a ZED2 from Stereolabs) that provides depth images and PointCloud2 point clouds.

I already use it to detect "normal" obstacles (using the pointcloud_to_laserscan node).

Now I would like to detect holes in the ground.

Do you know any package or algorithm to detect the holes in the ground?

I tried the trivial solution to put a threshold of -10cm on the z coordinates (relatively to ground level) of the PointCloud2. I get a lot of false positives, mainly due to the oscillations of the robot (the camera is at 90cm from the ground).

Do you have any idea how to detect holes (or just the distance of the nearest one, it's already enough).

Thanks a lot in advance


edit retag flag offensive close merge delete


you could segment out the ground with RANSAC and assume that all outliers below the plane are hole points

avzmpy gravatar image avzmpy  ( 2021-04-27 07:53:51 -0500 )edit

Thanks for your suggestion. The RANSAC should indeed solve the problem of the oscillation.

However, if there is a single step and the robot is on the higher part, then when the robot is to near from the step, the best consent will be the ground at the bottom of the step (so the bottom of the step will not be viewed as a hole). But maybe it is possible to find something either by forcing the plane to pass bellow the robot, or by checking the "height" of the robot compared to the plane we find

felixN gravatar image felixN  ( 2021-04-27 08:24:58 -0500 )edit

a robot is aware of its footprint frame, so anything below that is basically below the ground

avzmpy gravatar image avzmpy  ( 2021-04-27 08:50:17 -0500 )edit

In an ideal world, I totally agree. That was also my first try on the robot. My camera at 88cm from the ground, with a vertical image plane. So I considered all points with Z bellow -98cm (in camera frame) as being holes. In practice, when driving, event on very plat ground (like office floor), I detect holes nearly 100% of the time because of the oscillations of the robot.

So I need some kind of "floor matching" or detection of variations of the height.

felixN gravatar image felixN  ( 2021-04-27 09:00:21 -0500 )edit

But if you have a segmented plane (coinciding with base_footrpint more or less) those outliers should be filtered out by RANSAC and you could count how many points are left below the plane.

avzmpy gravatar image avzmpy  ( 2021-04-27 09:10:39 -0500 )edit

Sorry, I was thinking you were suggesting the footprint frame instead of RANSAC.

Yes, forcing the footprint frame to be part of the RANSAC plane might do the job. I will just have to figure out how to handle the case were the ground plane were the robot sits is completly (or mainly) out of view, for example because the robot is just on top of a step

felixN gravatar image felixN  ( 2021-04-27 09:42:31 -0500 )edit

Hello my friend. I wanted to know if you managed to do the hole detection in ROS, I am doing a similar implementation and I would like to know in which direction I can go so I don't waste too much time, I appreciate it.

jhorivas07 gravatar image jhorivas07  ( 2022-11-10 22:02:52 -0500 )edit