Point Cloud Library (PCL)
1.10.0
|
43 #include <pcl/sample_consensus/sac_model.h>
44 #include <pcl/sample_consensus/model_types.h>
58 template <
typename Po
intT>
95 const std::vector<int> &indices,
135 Eigen::VectorXf &model_coefficients)
const override;
143 std::vector<double> &distances)
const override;
152 const double threshold,
153 std::vector<int> &inliers)
override;
163 const double threshold)
const override;
173 const Eigen::VectorXf &model_coefficients,
174 Eigen::VectorXf &optimized_coefficients)
const override;
185 const Eigen::VectorXf &model_coefficients,
187 bool copy_data_fields =
true)
const override;
196 const Eigen::VectorXf &model_coefficients,
197 const double threshold)
const override;
210 isModelValid (
const Eigen::VectorXf &model_coefficients)
const override
228 isSampleGood(
const std::vector<int> &samples)
const override;
246 operator() (
const Eigen::VectorXf &x, Eigen::VectorXf &fvec)
const
248 Eigen::Vector4f cen_t;
250 for (
int i = 0; i < values (); ++i)
253 cen_t[0] = model_->input_->points[
indices_[i]].x - x[0];
254 cen_t[1] = model_->input_->points[
indices_[i]].y - x[1];
255 cen_t[2] = model_->input_->points[
indices_[i]].z - x[2];
258 fvec[i] = std::sqrt (cen_t.dot (cen_t)) - x[3];
269 #ifdef PCL_NO_PRECOMPILE
270 #include <pcl/sample_consensus/impl/sac_model_sphere.hpp>
This file defines compatibility wrappers for low level I/O functions.
std::size_t countWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold) const override
Count all the points which respect the given model coefficients as inliers.
bool computeModelCoefficients(const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) const override
Check whether the given index samples can form a valid sphere model, compute the model coefficients f...
~SampleConsensusModelSphere()
Empty destructor.
unsigned int sample_size_
The size of a sample from which the model is computed.
unsigned int model_size_
The number of coefficients in the model.
A point structure representing Euclidean xyz coordinates, and the RGB color.
bool isSampleGood(const std::vector< int > &samples) const override
Check if a sample of indices results in a good sample of points indices.
void getDistancesToModel(const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) const override
Compute all distances from the cloud data to a given sphere model.
SampleConsensusModelSphere(const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false)
Constructor for base SampleConsensusModelSphere.
void selectWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers) override
Select all the points which respect the given model coefficients as inliers.
Base functor all the models that need non linear optimization must define their own one and implement...
IndicesPtr indices_
A pointer to the vector of point indices to use.
shared_ptr< const SampleConsensusModel< pcl::PointXYZRGB > > ConstPtr
pcl::SacModel getModelType() const override
Return a unique id for this model (SACMODEL_SPHERE).
double radius_min_
The minimum and maximum radius limits for the model.
shared_ptr< SampleConsensusModel< pcl::PointXYZRGB > > Ptr
std::string model_name_
The model name.
SampleConsensusModelSphere(const PointCloudConstPtr &cloud, bool random=false)
Constructor for base SampleConsensusModelSphere.
typename PointCloud::ConstPtr PointCloudConstPtr
void projectPoints(const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) const override
Create a new point cloud with inliers projected onto the sphere model.
bool isModelValid(const Eigen::VectorXf &model_coefficients) const override
Check whether a model is valid given the user constraints.
bool doSamplesVerifyModel(const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) const override
Verify whether a subset of indices verifies the given sphere model coefficients.
SampleConsensusModelSphere(const SampleConsensusModelSphere &source)
Copy constructor.
SampleConsensusModelSphere & operator=(const SampleConsensusModelSphere &source)
Copy constructor.
typename PointCloud::Ptr PointCloudPtr
void optimizeModelCoefficients(const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) const override
Recompute the sphere coefficients using the given inlier set and return them to the user.
SampleConsensusModel represents the base model class.
boost::shared_ptr< T > shared_ptr
Alias for boost::shared_ptr.
SampleConsensusModelSphere defines a model for 3D sphere segmentation.