42 #include <pcl/pcl_base.h>
43 #include <pcl/PointIndices.h>
44 #include <pcl/ModelCoefficients.h>
47 #include <pcl/sample_consensus/method_types.h>
48 #include <pcl/sample_consensus/sac.h>
50 #include <pcl/sample_consensus/model_types.h>
51 #include <pcl/sample_consensus/sac_model.h>
53 #include <pcl/search/search.h>
63 template <
typename Po
intT>
217 inline Eigen::Vector3f
248 initSAC (
const int method_type);
281 Eigen::Vector3f
axis_{Eigen::Vector3f::Zero()};
304 template <
typename Po
intT,
typename Po
intNT>
414 getClassName ()
const override {
return (
"SACSegmentationFromNormals"); }
418 #ifdef PCL_NO_PRECOMPILE
419 #include <pcl/segmentation/impl/sac_segmentation.hpp>
typename PointCloud::Ptr PointCloudPtr
typename PointCloud::ConstPtr PointCloudConstPtr
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
SACSegmentationFromNormals represents the PCL nodelet segmentation class for Sample Consensus methods...
double distance_weight_
The relative weight (between 0 and 1) to give to the angular distance (0 to pi/2) between point norma...
void setInputNormals(const PointCloudNConstPtr &normals)
Provide a pointer to the input dataset that contains the point normals of the XYZ dataset.
double min_angle_
The minimum and maximum allowed opening angle of valid cone model.
PointCloudNConstPtr getInputNormals() const
Get a pointer to the normals of the input XYZ point cloud dataset.
typename PointCloudN::ConstPtr PointCloudNConstPtr
void getMinMaxOpeningAngle(double &min_angle, double &max_angle)
Get the opening angle which we need minimum to validate a cone model.
std::string getClassName() const override
Class get name method.
SACSegmentationFromNormals(bool random=false)
Empty constructor.
bool initSACModel(const int model_type) override
Initialize the Sample Consensus model and set its parameters.
void setMinMaxOpeningAngle(const double &min_angle, const double &max_angle)
Set the minimum opning angle for a cone model.
PointCloudNConstPtr normals_
A pointer to the input dataset that contains the point normals of the XYZ dataset.
double distance_from_origin_
The distance from the template plane to the origin.
void setDistanceFromOrigin(const double d)
Set the distance we expect a plane model to be from the origin.
typename SampleConsensusModelFromNormals< PointT, PointNT >::Ptr SampleConsensusModelFromNormalsPtr
double getDistanceFromOrigin() const
Get the distance of a plane model from the origin.
typename PointCloudN::Ptr PointCloudNPtr
double getNormalDistanceWeight() const
Get the relative weight (between 0 and 1) to give to the angular distance (0 to pi/2) between point n...
void setNormalDistanceWeight(double distance_weight)
Set the relative weight (between 0 and 1) to give to the angular distance (0 to pi/2) between point n...
SACSegmentation represents the Nodelet segmentation class for Sample Consensus methods and models,...
int getMethodType() const
Get the type of sample consensus method used.
void setRadiusLimits(const double &min_radius, const double &max_radius)
Set the minimum and maximum allowable radius limits for the model (applicable to models that estimate...
SampleConsensusModelPtr model_
The model that needs to be segmented.
~SACSegmentation() override=default
Empty destructor.
void setMethodType(int method)
The type of sample consensus method to use (user given parameter).
void setAxis(const Eigen::Vector3f &ax)
Set the axis along which we need to search for a model perpendicular to.
virtual void initSAC(const int method_type)
Initialize the Sample Consensus method and set its parameters.
double probability_
Desired probability of choosing at least one sample free from outliers (user given parameter).
double getDistanceThreshold() const
Get the distance to the model threshold.
double getProbability() const
Get the probability of choosing at least one sample free from outliers.
int model_type_
The type of model to use (user given parameter).
void setMaxIterations(int max_iterations)
Set the maximum number of iterations before giving up.
virtual void segment(PointIndices &inliers, ModelCoefficients &model_coefficients)
Base method for segmentation of a model in a PointCloud given by <setInputCloud (),...
bool getOptimizeCoefficients() const
Get the coefficient refinement internal flag.
SampleConsensusPtr getMethod() const
Get a pointer to the SAC method used.
void setProbability(double probability)
Set the probability of choosing at least one sample free from outliers.
virtual bool initSACModel(const int model_type)
Initialize the Sample Consensus model and set its parameters.
void setEpsAngle(double ea)
Set the angle epsilon (delta) threshold.
bool random_
Set to true if we need a random seed.
SampleConsensusPtr sac_
The sample consensus segmentation method.
typename SampleConsensusModel< PointT >::Ptr SampleConsensusModelPtr
double radius_min_
The minimum and maximum radius limits for the model.
virtual std::string getClassName() const
Class get name method.
SearchPtr samples_radius_search_
The search object for picking subsequent samples using radius search.
double getEpsAngle() const
Get the epsilon (delta) model angle threshold in radians.
void getSamplesMaxDist(double &radius)
Get maximum distance allowed when drawing random samples.
int getModelType() const
Get the type of SAC model used.
void setModelType(int model)
The type of model to use (user given parameter).
void setDistanceThreshold(double threshold)
Distance to the model threshold (user given parameter).
typename pcl::search::Search< PointT >::Ptr SearchPtr
Eigen::Vector3f axis_
The axis along which we need to search for a model perpendicular to.
bool optimize_coefficients_
Set to true if a coefficient refinement is required.
void setNumberOfThreads(const int nr_threads=-1)
Set the number of threads to use or turn off parallelization.
double eps_angle_
The maximum allowed difference between the model normal and the given axis.
SampleConsensusModelPtr getModel() const
Get a pointer to the SAC model used.
void setSamplesMaxDist(const double &radius, SearchPtr search)
Set the maximum distance allowed when drawing random samples.
void setOptimizeCoefficients(bool optimize)
Set to true if a coefficient refinement is required.
double samples_radius_
The maximum distance of subsequent samples from the first (radius search)
typename SampleConsensus< PointT >::Ptr SampleConsensusPtr
int getMaxIterations() const
Get maximum number of iterations before giving up.
SACSegmentation(bool random=false)
Empty constructor.
void getRadiusLimits(double &min_radius, double &max_radius)
Get the minimum and maximum allowable radius limits for the model as set by the user.
int method_type_
The type of sample consensus method to use (user given parameter).
double threshold_
Distance to the model threshold (user given parameter).
Eigen::Vector3f getAxis() const
Get the axis along which we need to search for a model perpendicular to.
int max_iterations_
Maximum number of iterations before giving up (user given parameter).
int threads_
The number of threads the scheduler should use, or a negative number if no parallelization is wanted.
SampleConsensus represents the base class.
shared_ptr< SampleConsensusModelFromNormals< PointT, PointNT > > Ptr
shared_ptr< SampleConsensusModel< PointT > > Ptr
shared_ptr< pcl::search::Search< PointT > > Ptr
A point structure representing Euclidean xyz coordinates, and the RGB color.