Point Cloud Library (PCL)
1.11.1-dev
|
40 #include <pcl/sample_consensus/sac_model.h>
41 #include <pcl/sample_consensus/model_types.h>
59 template <
typename Po
intT>
73 using Ptr = shared_ptr<SampleConsensusModelCircle3D<PointT> >;
74 using ConstPtr = shared_ptr<const SampleConsensusModelCircle3D<PointT> >;
134 Eigen::VectorXf &model_coefficients)
const override;
142 std::vector<double> &distances)
const override;
151 const double threshold,
162 const double threshold)
const override;
172 const Eigen::VectorXf &model_coefficients,
173 Eigen::VectorXf &optimized_coefficients)
const override;
183 const Eigen::VectorXf &model_coefficients,
185 bool copy_data_fields =
true)
const override;
194 const Eigen::VectorXf &model_coefficients,
195 const double threshold)
const override;
209 isModelValid (
const Eigen::VectorXf &model_coefficients)
const override;
233 int operator() (
const Eigen::VectorXd &x, Eigen::VectorXd &fvec)
const
235 for (
int i = 0; i < values (); ++i)
240 (*model_->input_)[
indices_[i]].getVector3fMap().template cast<double>();
242 Eigen::Vector3d C (x[0], x[1], x[2]);
244 Eigen::Vector3d N (x[4], x[5], x[6]);
248 Eigen::Vector3d helperVectorPC = P - C;
251 double lambda = (-(helperVectorPC.dot (N))) / N.dot (N);
253 Eigen::Vector3d P_proj = P + lambda * N;
254 Eigen::Vector3d helperVectorP_projC = P_proj - C;
257 Eigen::Vector3d
K = C + r * helperVectorP_projC.normalized ();
258 Eigen::Vector3d distanceVector = P -
K;
260 fvec[i] = distanceVector.norm ();
271 #ifdef PCL_NO_PRECOMPILE
272 #include <pcl/sample_consensus/impl/sac_model_circle3d.hpp>
bool isSampleGood(const Indices &samples) const override
Check if a sample of indices results in a good sample of points indices.
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 3d circle model.
unsigned int sample_size_
The size of a sample from which the model is computed.
SampleConsensusModelCircle3D(const PointCloudConstPtr &cloud, const Indices &indices, bool random=false)
Constructor for base SampleConsensusModelCircle3D.
bool computeModelCoefficients(const Indices &samples, Eigen::VectorXf &model_coefficients) const override
Check whether the given index samples can form a valid 2D circle model, compute the model coefficient...
unsigned int model_size_
The number of coefficients in the model.
pcl::SacModel getModelType() const override
Return a unique id for this model (SACMODEL_CIRCLE3D).
A point structure representing Euclidean xyz coordinates, and the RGB color.
~SampleConsensusModelCircle3D()
Empty destructor.
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
SampleConsensusModelCircle3D defines a model for 3D circle segmentation.
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.
shared_ptr< SampleConsensusModel< pcl::PointXYZRGB > > Ptr
std::string model_name_
The model name.
SampleConsensusModelCircle3D(const SampleConsensusModelCircle3D &source)
Copy constructor.
IndicesAllocator<> Indices
Type used for indices in PCL.
typename PointCloud::ConstPtr PointCloudConstPtr
bool isModelValid(const Eigen::VectorXf &model_coefficients) const override
Check whether a model is valid given the user constraints.
SampleConsensusModelCircle3D & operator=(const SampleConsensusModelCircle3D &source)
Copy constructor.
SampleConsensusModelCircle3D(const PointCloudConstPtr &cloud, bool random=false)
Constructor for base SampleConsensusModelCircle3D.
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 3d circle model coefficients.
void selectWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold, Indices &inliers) override
Compute all distances from the cloud data to a given 3D circle model.
typename PointCloud::Ptr PointCloudPtr
SampleConsensusModel represents the base model class.
void optimizeModelCoefficients(const Indices &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) const override
Recompute the 3d circle coefficients using the given inlier set and return them to the user.
void getDistancesToModel(const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) const override
Compute all distances from the cloud data to a given 3D circle model.