Ask Your Question

detect/extract a "small" sphere using PCL

asked 2011-06-24 12:59:44 -0500

Liang-Ting Jiang gravatar image

updated 2014-04-20 14:09:49 -0500

ngrennan gravatar image

The radius of the sphere I am detecting is about 2cm (very small). I tried to modify the PCL tutorial which does cylinder model segmentation ( I have tried different sets of parameters. After I increase the MaxIteration to a large number (100000), I am able to detect larger ball (r = 15cm), but not a small ball (r = 2cm).

The pointclouds are from Kinect using openni_kinect driver.

This is the code I use:

pcl::ModelCoefficients coefficients;
pcl::PointIndices inliers;
pcl::SACSegmentation<pcl::PointXYZ> seg;
seg.setOptimizeCoefficients (false);
seg.setModelType (pcl::SACMODEL_SPHERE); //detecting SPHERE
seg.setMethodType (pcl::SAC_RANSAC);
seg.setDistanceThreshold (0.001);
seg.setRadiusLimits(0.001, 0.20);
seg.setInputCloud (filteredCloud.makeShared ());
seg.segment (inliers, coefficients);
ROS_INFO_STREAM("# Inliers points: " << inliers.indices.size());

Is Normal Estimation Required for doing sphere fitting? Or is there any parameter I didn't setup well?

I am also wondering if there is a better method to detect a small ball in Pointclouds other than SAC_Segmentation since randomly picking up points in the clouds might not be ideal for finding such small objects, besides I have a specific ball to detect.

Any help would be greatly appreciated!


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-06-24 16:09:40 -0500

phil0stine gravatar image

updated 2011-06-24 16:12:25 -0500

If you are using a kinect you could first try to find the sphere or bound the search space using the rgb image.

More generally, a feature set could be constructed and searched for. The features might include color, radius, and normal distribution.

One issue will be getting proper normals for such a small sphere. I think using normals from the kinect won't work from far away. The farther it is from a 2cm sphere, the fewer points will give you the normal you want (and need) to ID a sphere.

Try it from closer up, with fewer neighbors in your normal extraction step.

edit flag offensive delete link more


Thanks for the help. Do you mean searching for 2D features in the RGB image instead of using pcl? Another question is, should I call the normal estimation function before I call the SAC model segment function? I can detect a larger sphere without doing the normal estimation.
Liang-Ting Jiang gravatar image Liang-Ting Jiang  ( 2011-06-28 07:42:25 -0500 )edit
I would definitely use pcl to identify spheres, cylinders, planes, etc. I was also suggesting that you could use image processing to identify a ROI, then find the sphere using pcl. Check out the cylinder segmentation example in pcl_tutorials for how to use normals in your segmentation.
phil0stine gravatar image phil0stine  ( 2011-06-29 06:08:07 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2011-06-24 12:59:44 -0500

Seen: 2,623 times

Last updated: Jun 24 '11