Point Cloud Library (PCL)
1.11.1
|
43 #include <pcl/sample_consensus/sac_model.h>
44 #include <pcl/sample_consensus/model_types.h>
58 template <
typename Po
intT>
73 using Ptr = shared_ptr<SampleConsensusModelSphere<PointT> >;
74 using ConstPtr = shared_ptr<const SampleConsensusModelSphere<PointT>>;
135 Eigen::VectorXf &model_coefficients)
const override;
143 std::vector<double> &distances)
const override;
152 const double threshold,
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
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.head<3>() = (*model_->input_)[
indices_[i]].getVector3fMap() - x.head<3>();
256 fvec[i] = std::sqrt (cen_t.dot (cen_t)) - x[3];
267 #ifdef PCL_NO_PRECOMPILE
268 #include <pcl/sample_consensus/impl/sac_model_sphere.hpp>
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 isSampleGood(const Indices &samples) const override
Check if a sample of indices results in a good sample of points indices.
~SampleConsensusModelSphere()
Empty destructor.
unsigned int sample_size_
The size of a sample from which the model is computed.
SampleConsensusModelSphere(const PointCloudConstPtr &cloud, const Indices &indices, bool random=false)
Constructor for base SampleConsensusModelSphere.
unsigned int model_size_
The number of coefficients in the model.
A point structure representing Euclidean xyz coordinates, and the RGB color.
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.
void optimizeModelCoefficients(const Indices &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.
Base functor all the models that need non linear optimization must define their own one and implement...
bool computeModelCoefficients(const Indices &samples, Eigen::VectorXf &model_coefficients) const override
Check whether the given index samples can form a valid sphere model, compute the model coefficients f...
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.
IndicesAllocator<> Indices
Type used for indices in PCL.
bool doSamplesVerifyModel(const std::set< index_t > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) const override
Verify whether a subset of indices verifies the given sphere model coefficients.
typename PointCloud::ConstPtr PointCloudConstPtr
bool isModelValid(const Eigen::VectorXf &model_coefficients) const override
Check whether a model is valid given the user constraints.
SampleConsensusModelSphere(const SampleConsensusModelSphere &source)
Copy constructor.
void projectPoints(const Indices &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.
void selectWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold, Indices &inliers) override
Select all the points which respect the given model coefficients as inliers.
SampleConsensusModelSphere & operator=(const SampleConsensusModelSphere &source)
Copy constructor.
typename PointCloud::Ptr PointCloudPtr
SampleConsensusModel represents the base model class.
SampleConsensusModelSphere defines a model for 3D sphere segmentation.