41 #ifndef PCL_SAMPLE_CONSENSUS_MODEL_LINE_H_
42 #define PCL_SAMPLE_CONSENSUS_MODEL_LINE_H_
44 #include <pcl/sample_consensus/sac_model.h>
45 #include <pcl/sample_consensus/model_types.h>
46 #include <pcl/common/eigen.h>
62 template <
typename Po
intT>
74 typedef boost::shared_ptr<SampleConsensusModelLine>
Ptr;
89 const std::vector<int> &indices,
104 Eigen::VectorXf &model_coefficients);
112 std::vector<double> &distances);
121 const double threshold,
122 std::vector<int> &inliers);
132 const double threshold);
142 const Eigen::VectorXf &model_coefficients,
143 Eigen::VectorXf &optimized_coefficients);
153 const Eigen::VectorXf &model_coefficients,
154 PointCloud &projected_points,
155 bool copy_data_fields =
true);
164 const Eigen::VectorXf &model_coefficients,
165 const double threshold);
178 if (model_coefficients.size () != 6)
180 PCL_ERROR (
"[pcl::SampleConsensusModelLine::selectWithinDistance] Invalid number of model coefficients given (%lu)!\n", model_coefficients.size ());
196 #ifdef PCL_NO_PRECOMPILE
197 #include <pcl/sample_consensus/impl/sac_model_line.hpp>
200 #endif //#ifndef PCL_SAMPLE_CONSENSUS_MODEL_LINE_H_
SampleConsensusModel< PointT >::PointCloud PointCloud
bool computeModelCoefficients(const std::vector< int > &samples, Eigen::VectorXf &model_coefficients)
Check whether the given index samples can form a valid line model, compute the model coefficients fro...
SampleConsensusModelLine defines a model for 3D line segmentation.
SampleConsensusModel< PointT >::PointCloudPtr PointCloudPtr
SampleConsensusModelLine(const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false)
Constructor for base SampleConsensusModelLine.
void getDistancesToModel(const Eigen::VectorXf &model_coefficients, std::vector< double > &distances)
Compute all squared distances from the cloud data to a given line model.
bool doSamplesVerifyModel(const std::set< int > &indices, const Eigen::VectorXf &model_coefficients, const double threshold)
Verify whether a subset of indices verifies the given line model coefficients.
SampleConsensusModel< PointT >::PointCloudConstPtr PointCloudConstPtr
virtual int countWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold)
Count all the points which respect the given model coefficients as inliers.
SampleConsensusModelLine(const PointCloudConstPtr &cloud, bool random=false)
Constructor for base SampleConsensusModelLine.
SampleConsensusModel represents the base model class.
bool isSampleGood(const std::vector< int > &samples) const
Check if a sample of indices results in a good sample of points indices.
pcl::PointCloud< PointT >::Ptr PointCloudPtr
void optimizeModelCoefficients(const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients)
Recompute the line coefficients using the given inlier set and return them to the user...
boost::shared_ptr< SampleConsensusModelLine > Ptr
pcl::SacModel getModelType() const
Return an unique id for this model (SACMODEL_LINE).
pcl::PointCloud< PointT >::ConstPtr PointCloudConstPtr
PointCloud represents the base class in PCL for storing collections of 3D points. ...
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 line 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.
A point structure representing Euclidean xyz coordinates, and the RGB color.
bool isModelValid(const Eigen::VectorXf &model_coefficients)
Check whether a model is valid given the user constraints.
virtual ~SampleConsensusModelLine()
Empty destructor.