detect/extract a "small" sphere using PCL
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.setMaxIterations(100000);
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!
-LT