41 #ifndef PCL_SAMPLE_CONSENSUS_MODEL_CIRCLE2D_H_ 42 #define PCL_SAMPLE_CONSENSUS_MODEL_CIRCLE2D_H_ 44 #include <pcl/sample_consensus/sac_model.h> 45 #include <pcl/sample_consensus/model_types.h> 59 template <
typename Po
intT>
74 typedef boost::shared_ptr<SampleConsensusModelCircle2D>
Ptr;
94 const std::vector<int> &indices,
123 tmp_inliers_ = source.tmp_inliers_;
134 Eigen::VectorXf &model_coefficients);
142 std::vector<double> &distances);
151 const double threshold,
152 std::vector<int> &inliers);
162 const double threshold);
172 const Eigen::VectorXf &model_coefficients,
173 Eigen::VectorXf &optimized_coefficients);
183 const Eigen::VectorXf &model_coefficients,
185 bool copy_data_fields =
true);
194 const Eigen::VectorXf &model_coefficients,
195 const double threshold);
209 isModelValid (
const Eigen::VectorXf &model_coefficients);
219 const std::vector<int> *tmp_inliers_;
221 #if defined BUILD_Maintainer && defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ > 3 222 #pragma GCC diagnostic ignored "-Weffc++" 233 pcl::
Functor<float>(m_data_points), model_ (model) {}
241 operator() (
const Eigen::VectorXf &x, Eigen::VectorXf &fvec)
const 243 for (
int i = 0; i < values (); ++i)
246 float xt = model_->input_->points[(*model_->tmp_inliers_)[i]].x - x[0];
247 float yt = model_->input_->points[(*model_->tmp_inliers_)[i]].y - x[1];
250 fvec[i] = std::sqrt (xt * xt + yt * yt) - x[2];
257 #if defined BUILD_Maintainer && defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ > 3 258 #pragma GCC diagnostic warning "-Weffc++" 263 #ifdef PCL_NO_PRECOMPILE 264 #include <pcl/sample_consensus/impl/sac_model_circle.hpp> 267 #endif //#ifndef PCL_SAMPLE_CONSENSUS_MODEL_CIRCLE2D_H_ boost::shared_ptr< SampleConsensusModelCircle2D > Ptr
void getDistancesToModel(const Eigen::VectorXf &model_coefficients, std::vector< double > &distances)
Compute all distances from the cloud data to a given 2D circle model.
void selectWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers)
Compute all distances from the cloud data to a given 2D circle model.
unsigned int model_size_
The number of coefficients in the model.
SampleConsensusModel< PointT >::PointCloudConstPtr PointCloudConstPtr
SampleConsensusModelCircle2D(const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false)
Constructor for base SampleConsensusModelCircle2D.
Base functor all the models that need non linear optimization must define their own one and implement...
SampleConsensusModelCircle2D defines a model for 2D circle segmentation on the X-Y plane...
void projectPoints(const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true)
Create a new point cloud with inliers projected onto the 2d circle model.
SampleConsensusModel represents the base model class.
std::string model_name_
The model name.
pcl::PointCloud< PointT >::Ptr PointCloudPtr
virtual ~SampleConsensusModelCircle2D()
Empty destructor.
bool doSamplesVerifyModel(const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold)
Verify whether a subset of indices verifies the given 2d circle model coefficients.
SampleConsensusModelCircle2D(const SampleConsensusModelCircle2D &source)
Copy constructor.
pcl::SacModel getModelType() const
Return an unique id for this model (SACMODEL_CIRCLE2D).
bool isSampleGood(const std::vector< int > &samples) const
Check if a sample of indices results in a good sample of points indices.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
pcl::PointCloud< PointT >::ConstPtr PointCloudConstPtr
SampleConsensusModelCircle2D(const PointCloudConstPtr &cloud, bool random=false)
Constructor for base SampleConsensusModelCircle2D.
virtual int countWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold)
Count all the points which respect the given model coefficients as inliers.
SampleConsensusModel< PointT >::PointCloud PointCloud
SampleConsensusModelCircle2D & operator=(const SampleConsensusModelCircle2D &source)
Copy constructor.
A point structure representing Euclidean xyz coordinates, and the RGB color.
void optimizeModelCoefficients(const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients)
Recompute the 2d circle coefficients using the given inlier set and return them to the user...
virtual bool isModelValid(const Eigen::VectorXf &model_coefficients)
Check whether a model is valid given the user constraints.
SampleConsensusModel< PointT >::PointCloudPtr PointCloudPtr
bool computeModelCoefficients(const std::vector< int > &samples, Eigen::VectorXf &model_coefficients)
Check whether the given index samples can form a valid 2D circle model, compute the model coefficient...
unsigned int sample_size_
The size of a sample from which the model is computed.