Rosanswers logo

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 (http://www.pointclouds.org/documentation/tutorials/cylinder_segmentation.php#cylinder-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!


Originally posted by Liang-Ting Jiang on ROS Answers with karma: 21 on 2011-06-24

Post score: 0


1 Answer 1


Rosanswers logo

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.

Originally posted by phil0stine with karma: 682 on 2011-06-24

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by phil0stine on 2011-06-29:
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.

Comment by Liang-Ting Jiang on 2011-06-28:
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.


Your Answer

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