Point Cloud Library (PCL)
1.11.1-dev
|
43 #include <pcl/sample_consensus/sac_model.h>
44 #include <pcl/sample_consensus/model_types.h>
54 template <
typename Po
int>
inline void
55 projectPoint (
const Point &p,
const Eigen::Vector4f &model_coefficients, Point &q)
58 Eigen::Vector4f pp (p.x, p.y, p.z, 1);
60 float distance_to_plane = pp.dot(model_coefficients);
67 Eigen::Vector4f q_e = pp - distance_to_plane * model_coefficients;
81 template <
typename Po
int>
inline double
84 return (a * p.x + b * p.y + c * p.z + d);
92 template <
typename Po
int>
inline double
95 return ( plane_coefficients[0] * p.x + plane_coefficients[1] * p.y + plane_coefficients[2] * p.z + plane_coefficients[3] );
106 template <
typename Po
int>
inline double
117 template <
typename Po
int>
inline double
134 template <
typename Po
intT>
148 using Ptr = shared_ptr<SampleConsensusModelPlane<PointT> >;
149 using ConstPtr = shared_ptr<const SampleConsensusModelPlane<PointT>>;
189 Eigen::VectorXf &model_coefficients)
const override;
197 std::vector<double> &distances)
const override;
206 const double threshold,
217 const double threshold)
const override;
227 const Eigen::VectorXf &model_coefficients,
228 Eigen::VectorXf &optimized_coefficients)
const override;
238 const Eigen::VectorXf &model_coefficients,
240 bool copy_data_fields =
true)
const override;
249 const Eigen::VectorXf &model_coefficients,
250 const double threshold)
const override;
265 const double threshold,
266 std::size_t i = 0)
const;
268 #if defined (__SSE__) && defined (__SSE2__) && defined (__SSE4_1__)
273 countWithinDistanceSSE (
const Eigen::VectorXf &model_coefficients,
274 const double threshold,
275 std::size_t i = 0)
const;
278 #if defined (__AVX__) && defined (__AVX2__)
283 countWithinDistanceAVX (
const Eigen::VectorXf &model_coefficients,
284 const double threshold,
285 std::size_t i = 0)
const;
289 inline __m256 dist8 (
const std::size_t i,
const __m256 &a_vec,
const __m256 &b_vec,
const __m256 &c_vec,
const __m256 &d_vec,
const __m256 &abs_help)
const;
293 inline __m128 dist4 (
const std::size_t i,
const __m128 &a_vec,
const __m128 &b_vec,
const __m128 &c_vec,
const __m128 &d_vec,
const __m128 &abs_help)
const;
302 isSampleGood (
const Indices &samples)
const override;
306 #ifdef PCL_NO_PRECOMPILE
307 #include <pcl/sample_consensus/impl/sac_model_plane.hpp>
SampleConsensusModelPlane(const PointCloudConstPtr &cloud, const Indices &indices, bool random=false)
Constructor for base SampleConsensusModelPlane.
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.
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.
SampleConsensusModelPlane defines a model for 3D plane segmentation.
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.
PointCloud represents the base class in PCL for storing collections of 3D points.
double pointToPlaneDistance(const Point &p, double a, double b, double c, double d)
Get the distance from a point to a plane (unsigned) defined by ax+by+cz+d=0.
SampleConsensusModelPlane(const PointCloudConstPtr &cloud, bool random=false)
Constructor for base SampleConsensusModelPlane.
A point structure representing Euclidean xyz coordinates, and the RGB color.
std::size_t countWithinDistanceStandard(const Eigen::VectorXf &model_coefficients, const double threshold, std::size_t i=0) const
This implementation uses no SIMD instructions.
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 plane model.
void optimizeModelCoefficients(const Indices &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) const override
Recompute the plane coefficients using the given inlier set and return them to the user.
bool computeModelCoefficients(const Indices &samples, Eigen::VectorXf &model_coefficients) const override
Check whether the given index samples can form a valid plane model, compute the model coefficients fr...
shared_ptr< const SampleConsensusModel< PointT > > ConstPtr
shared_ptr< SampleConsensusModel< PointT > > Ptr
std::string model_name_
The model name.
IndicesAllocator<> Indices
Type used for indices in PCL.
typename PointCloud::ConstPtr PointCloudConstPtr
void getDistancesToModel(const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) const override
Compute all distances from the cloud data to a given plane model.
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 plane model coefficients.
typename PointCloud::Ptr PointCloudPtr
SampleConsensusModel represents the base model class.
void projectPoint(const Point &p, const Eigen::Vector4f &model_coefficients, Point &q)
Project a point on a planar model given by a set of normalized coefficients.
pcl::SacModel getModelType() const override
Return a unique id for this model (SACMODEL_PLANE).
~SampleConsensusModelPlane()
Empty destructor.
double pointToPlaneDistanceSigned(const Point &p, double a, double b, double c, double d)
Get the distance from a point to a plane (signed) defined by ax+by+cz+d=0.