|
Point Cloud Library (PCL)
1.11.1-dev
|
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
235 const double threshold,
236 std::size_t i = 0)
const;
238 #if defined (__SSE__) && defined (__SSE2__) && defined (__SSE4_1__)
243 countWithinDistanceSSE (
const Eigen::VectorXf &model_coefficients,
244 const double threshold,
245 std::size_t i = 0)
const;
248 #if defined (__AVX__) && defined (__AVX2__)
253 countWithinDistanceAVX (
const Eigen::VectorXf &model_coefficients,
254 const double threshold,
255 std::size_t i = 0)
const;
274 operator() (
const Eigen::VectorXf &x, Eigen::VectorXf &fvec)
const
276 Eigen::Vector4f cen_t;
278 for (
int i = 0; i < values (); ++i)
281 cen_t.head<3>() = (*model_->input_)[
indices_[i]].getVector3fMap() - x.head<3>();
284 fvec[i] = std::sqrt (cen_t.dot (cen_t)) - x[3];
294 inline __m256 sqr_dist8 (
const std::size_t i,
const __m256 a_vec,
const __m256 b_vec,
const __m256 c_vec)
const;
298 inline __m128 sqr_dist4 (
const std::size_t i,
const __m128 a_vec,
const __m128 b_vec,
const __m128 c_vec)
const;
303 #ifdef PCL_NO_PRECOMPILE
304 #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...
std::size_t countWithinDistanceStandard(const Eigen::VectorXf &model_coefficients, const double threshold, std::size_t i=0) const
This implementation uses no SIMD instructions.
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.