pcl 1.7.2 SampleConsensusModelCone optimazed coefficients

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

pcl 1.7.2 SampleConsensusModelCone optimazed coefficients

nenadpol
HI,

I noticed that in sac_model_cone.hpp

template <typename PointT, typename PointNT> void
pcl::SampleConsensusModelCone<PointT, PointNT>::optimizeModelCoefficients (
      const std::vector<int> &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients)

computed optimazed coefficients for cone direction are not normalized.

..................................
  OptimizationFunctor functor (static_cast<int> (inliers.size ()), this);
  Eigen::NumericalDiff<OptimizationFunctor > num_diff (functor);
  Eigen::LevenbergMarquardt<Eigen::NumericalDiff<OptimizationFunctor>, float> lm (num_diff);
  int info = lm.minimize (optimized_coefficients);

  // Compute the L2 norm of the residuals
  PCL_DEBUG ("[pcl::SampleConsensusModelCone::optimizeModelCoefficients] LM solver finished with exit code %i, having a residual norm of %g. \nInitial solution: %g %g %g %g %g %g %g \nFinal solution: %g %g %g %g %g %g %g\n",
             info, lm.fvec.norm (), model_coefficients[0], model_coefficients[1], model_coefficients[2], model_coefficients[3],
             model_coefficients[4], model_coefficients[5], model_coefficients[6], optimized_coefficients[0], optimized_coefficients[1], optimized_coefficients[2], optimized_coefficients[3], optimized_coefficients[4], optimized_coefficients[5], optimized_coefficients[6]);

RETURNED CONE DIRECTION IS NOT NORMALIZED
......................................

Missing part shoul be something like this ( same as in sac_model_cylinder.hpp, line number 296):

  Eigen::Vector3f line_dir (optimized_coefficients[3], optimized_coefficients[4], optimized_coefficients[5]);
  line_dir.normalize ();
  optimized_coefficients[3] = line_dir[0];
  optimized_coefficients[4] = line_dir[1];
  optimized_coefficients[5] = line_dir[2];


Thanks
Nenad


Reply | Threaded
Open this post in threaded view
|

Re: pcl 1.7.2 SampleConsensusModelCone optimazed coefficients

Jochen Sprickerhof
Administrator
Hi Nenad,

* nenadpol <[hidden email]> [2015-08-26 00:45]:
> Missing part shoul be something like this ( same as in
> sac_model_cylinder.hpp, line number 296):
>
>   Eigen::Vector3f line_dir (optimized_coefficients[3],
> optimized_coefficients[4], optimized_coefficients[5]);
>   line_dir.normalize ();
>   optimized_coefficients[3] = line_dir[0];
>   optimized_coefficients[4] = line_dir[1];
>   optimized_coefficients[5] = line_dir[2];

Good catch. Can you send a pull request with the proposed patch?
You can find documentation on how to do it here:
https://github.com/PointCloudLibrary/pcl/blob/master/CONTRIBUTING.md

Thanks!

Jochen

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: pcl 1.7.2 SampleConsensusModelCone optimazed coefficients

nenadpol
Hi Jochen,

I'll do that

cheers
Nenad