41 #ifndef PCL_SAMPLE_CONSENSUS_MODEL_PLANE_H_ 42 #define PCL_SAMPLE_CONSENSUS_MODEL_PLANE_H_ 44 #include <pcl/sample_consensus/sac_model.h> 45 #include <pcl/sample_consensus/model_types.h> 55 template <
typename Po
int>
inline void 56 projectPoint (
const Point &p,
const Eigen::Vector4f &model_coefficients, Point &q)
59 Eigen::Vector4f pp (p.x, p.y, p.z, 1);
61 float distance_to_plane = pp.dot(model_coefficients);
68 Eigen::Vector4f q_e = pp - distance_to_plane * model_coefficients;
82 template <
typename Po
int>
inline double 85 return (a * p.x + b * p.y + c * p.z + d);
93 template <
typename Po
int>
inline double 96 return ( plane_coefficients[0] * p.x + plane_coefficients[1] * p.y + plane_coefficients[2] * p.z + plane_coefficients[3] );
107 template <
typename Po
int>
inline double 118 template <
typename Po
int>
inline double 135 template <
typename Po
intT>
149 typedef boost::shared_ptr<SampleConsensusModelPlane>
Ptr;
169 const std::vector<int> &indices,
189 Eigen::VectorXf &model_coefficients);
197 std::vector<double> &distances);
206 const double threshold,
207 std::vector<int> &inliers);
217 const double threshold);
227 const Eigen::VectorXf &model_coefficients,
228 Eigen::VectorXf &optimized_coefficients);
238 const Eigen::VectorXf &model_coefficients,
239 PointCloud &projected_points,
240 bool copy_data_fields =
true);
249 const Eigen::VectorXf &model_coefficients,
250 const double threshold);
266 isSampleGood (
const std::vector<int> &samples)
const;
270 #ifdef PCL_NO_PRECOMPILE 271 #include <pcl/sample_consensus/impl/sac_model_plane.hpp> 274 #endif //#ifndef PCL_SAMPLE_CONSENSUS_MODEL_PLANE_H_ 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.
SampleConsensusModelPlane(const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false)
Constructor for base SampleConsensusModelPlane.
boost::shared_ptr< SampleConsensusModelPlane > Ptr
pcl::SacModel getModelType() const
Return an unique id for this model (SACMODEL_PLANE).
unsigned int model_size_
The number of coefficients in the model.
void selectWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers)
Select all the points which respect the given model coefficients as inliers.
SampleConsensusModel< PointT >::PointCloud PointCloud
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.
SampleConsensusModel represents the base model class.
std::string model_name_
The model name.
void projectPoints(const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true)
Create a new point cloud with inliers projected onto the plane model.
pcl::PointCloud< PointT >::Ptr PointCloudPtr
bool computeModelCoefficients(const std::vector< int > &samples, Eigen::VectorXf &model_coefficients)
Check whether the given index samples can form a valid plane model, compute the model coefficients fr...
SampleConsensusModel< PointT >::PointCloudConstPtr PointCloudConstPtr
SampleConsensusModel< PointT >::PointCloudPtr PointCloudPtr
void getDistancesToModel(const Eigen::VectorXf &model_coefficients, std::vector< double > &distances)
Compute all distances from the cloud data to a given plane model.
SampleConsensusModelPlane(const PointCloudConstPtr &cloud, bool random=false)
Constructor for base SampleConsensusModelPlane.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
pcl::PointCloud< PointT >::ConstPtr PointCloudConstPtr
void optimizeModelCoefficients(const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients)
Recompute the plane coefficients using the given inlier set and return them to the user...
virtual ~SampleConsensusModelPlane()
Empty destructor.
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.
A point structure representing Euclidean xyz coordinates, and the RGB color.
SampleConsensusModelPlane defines a model for 3D plane segmentation.
bool doSamplesVerifyModel(const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold)
Verify whether a subset of indices verifies the given plane model coefficients.
virtual int countWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold)
Count all the points which respect the given model coefficients as inliers.
unsigned int sample_size_
The size of a sample from which the model is computed.