ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

What does setOptimizeCoefficients do in SACSegmentation

asked 2013-02-14 05:58:01 -0500

kalectro gravatar image

updated 2014-01-28 17:15:14 -0500

ngrennan gravatar image

I followed the tutorial about Segmentation in PCL and wondered what setOptimizeCoefficients does. In the tutorial the only comment is that it is optional and in the documentation I am told to set this parameter if a coefficient refinement is required. I am still not really what that is supposed to mean. Can anybody explain that to me?

Thanks in advance


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-02-25 13:42:55 -0500

astaranowicz gravatar image

I'll try to explain using an example from my experience.

The plane's parameters is the normal and the distance to the plane from a fixed reference frame. The model's (plane) coefficients, in this case, are the normal vector (x,y,z) and the offset.

The model's coefficients are estimated using a least-squares method inside RANSAC to find the best-fit model. Once those coefficients are found; an optimization is performed over the estimated coefficients to minimize or reduce the mean-squared-error with respect the all of the 3D points.

The optimization a bit longer and can fail if you have a large percentage of outliers.

This method is optional due to the fact that if you know you have no outliers and no noise, then the least-squares solution will be the same as the optimized (refined) solution. (Saves computational time)

However, if you know that your points are affected by noise and you had to remove outliers, then optimizing the model's coefficients will give a better solution with respect to the least-squares solution. (More time, but better solution)

Its a trade-off between time and quality of the solution.

edit flag offensive delete link more


thank you for this great explanation. I was hoping that this option would perform something like that.

kalectro gravatar image kalectro  ( 2013-02-25 15:31:28 -0500 )edit

answered 2022-08-11 02:25:19 -0500

ilansmolySR gravatar image


The algorithm works as follows:

  1. randomly select samples from the cloud, just as many as needed to determine a model
  2. compute the coefficients of the model from the samples
  3. count how many points of the cloud belong to the model, given a threshold. These are called inliers
  4. repeat until a good model has been found or a max number of iterations has been reached
  5. return the model with the most inliers

I believe the answer to you question is related to stage 4, in which the model parameters, if setOptimizeCoefficients is true, is refined to fit all inliers, instead of using the original parameters that were fitted in stage 2 for the random samples only.

edit flag offensive delete link more

Question Tools


Asked: 2013-02-14 05:58:01 -0500

Seen: 2,811 times

Last updated: Feb 25 '13