just curious if there is a way to define at what range along a given axis that you want RANSAC to search for the best plane?
ie, perform ransac perpendicular to the zaxis but within the range of 5 to 5 on the zaxis i could use a pcl pass through filter but just curious. i see that setAxis can be used to set the search area perpendicular to a axis. and is there any difference between setAxis and SACMODEL_PERPENDICULAR_PLANE? if i understand correctly, they both do the same thing, ie, saying find a plane that is perpendicular to this axis, or? thanks! 
Administrator

On 03/21/2012 05:17 AM, liquidmonkey wrote: > just curious if there is a way to define at what range along a given axis > that you want RANSAC to search for the best plane? > ie, perform ransac perpendicular to the zaxis but within the range of 5 to > 5 on the zaxis > > i could use a pcl pass through filter but just curious. I'm not sure if that level of detail is possible. I believe the models just accept an axis and an epsilon/threshold for the angle. > i see that setAxis can be used to set the search area perpendicular to a > axis. > > and is there any difference between setAxis and > SACMODEL_PERPENDICULAR_PLANE? if i understand correctly, they both do the > same thing, ie, saying find a plane that is perpendicular to this axis, or? Which models are you referring to? I didn't fully understand your question. Cheers, Radu.  http://pointclouds.org _______________________________________________ [hidden email] / http://pointclouds.org http://pointclouds.org/mailman/listinfo/pclusers 
i'll try and explain with my code...
pcl::SACSegmentation<pcl::PointXYZ> seg; seg.setModelType (pcl::SACMODEL_PLANE); seg.setMethodType (pcl::SAC_RANSAC); seg.setMaxIterations (1000); seg.setDistanceThreshold (0.05); // 5cm 0.05 seg.setAxis(Eigen::Vector3f (0, 0, 1)); // best plane should be perpendicular to zaxis seg.setEpsAngle (0.01); // 0.5 degrees what i'm seeing with the above is that ransac is NOT choosing a plane that is perpendicular to the zplane (giving me a xy plane) as the plane is sometimes tilted (much more than 0.5 degrees which also means that my setEpsAngle is not working either). so must i use SACMODEL_PERPENDICULAR_PLANE in order to use setAxis and/or setEpsAngle? 
Hey,
Sorry for bringing up an old thread... I am also stuck with the same thing.. I am trying to segment just the ground plane but neither "SACMODEL_PERPENDICULAR_PLANE" or using setAxis seem to work. Here's a snippet from my code pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients); pcl::PointIndices::Ptr inliers (new pcl::PointIndices); pcl::SACSegmentation<pcl::PointXYZRGB> seg; seg.setOptimizeCoefficients (true); seg.setModelType (pcl::SACMODEL_PLANE); const Eigen::Vector3f z(0,0,1); seg.setAxis(z); seg.setEpsAngle(0.1); seg.setMethodType (pcl::SAC_RANSAC); seg.setDistanceThreshold (0.01); I am using PCL1.5 bound with ROS Fuerte with a kinect mounted on a turtlebot. Thanks Saurabh 
Administrator

Hi Saurabh,
Please note that if you want to define a plane by its normal, you have to use seg.setModelType(pcl::SACMODEL_PERPENDICULAR_PLANE); Also note that EpsAngle is in radians. Finally, the normal for a horizontal plane won't necessarily be (0,0,1), because it is relative to your sensor (Kinect), not the world. In fact, I would suggest that you work this out in the opposite direction. First detect the plane that you want without imposing any restrictions, look at the resultant normal, and hardcode it in your algorithm. Cheers, Sergey 
Hi Sergey,
Voila that worked... I should have figured out what the model coefficients mean earlier.. Thanks for the reply Saurabh 
Free forum by Nabble  Edit this page 