42 #include <pcl/registration/correspondence_rejection.h>
43 #include <pcl/conversions.h>
44 #include <pcl/memory.h>
45 #include <pcl/point_cloud.h>
50 namespace registration {
71 using Ptr = shared_ptr<CorrespondenceRejectorVarTrimmed>;
72 using ConstPtr = shared_ptr<const CorrespondenceRejectorVarTrimmed>;
77 rejection_name_ =
"CorrespondenceRejectorVarTrimmed";
94 return trimmed_distance_;
101 template <
typename Po
intT>
105 if (!data_container_)
114 template <
typename Po
intT>
118 if (!data_container_)
136 setInputSource<PointXYZ>(cloud);
152 setInputTarget<PointXYZ>(cloud);
162 template <
typename Po
intT>
165 bool force_no_recompute =
false)
168 ->setSearchMethodTarget(tree, force_no_recompute);
220 getRemainingCorrespondences(*input_correspondences_, correspondences);
226 double trimmed_distance_{0.0};
236 double min_ratio_{0.05};
240 double max_ratio_{0.95};
245 double lambda_{0.95};
258 optimizeInlierRatio(std::vector<double>& dists)
const;
shared_ptr< KdTree< PointT, Tree > > Ptr
shared_ptr< const CorrespondenceRejector > ConstPtr
DataContainer is a container for the input and target point clouds and implements the interface to co...
bool requiresSourcePoints() const override
See if this rejector requires source points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< CorrespondenceRejector > Ptr
CorrespondenceRejectoVarTrimmed implements a simple correspondence rejection method by considering as...
CorrespondenceRejector represents the base class for correspondence rejection methods ...
shared_ptr< const ::pcl::PCLPointCloud2 > ConstPtr
void setTargetPoints(pcl::PCLPointCloud2::ConstPtr cloud2) override
Method for setting the target cloud.
DataContainerInterface::Ptr DataContainerPtr
void setInputTarget(const typename pcl::PointCloud< PointT >::ConstPtr &target)
Provide a target point cloud dataset (must contain XYZ data!), used to compute the correspondence dis...
DataContainerPtr data_container_
A pointer to the DataContainer object containing the input and target point clouds.
void setSourcePoints(pcl::PCLPointCloud2::ConstPtr cloud2) override
Blob method for setting the source cloud.
const std::string & getClassName() const
Get a string representation of the name of this class.
double getMaxRatio() const
brief get the maximum overlap ratio
void setMinRatio(double ratio)
brief set the minimum overlap ratio
double getTrimFactor() const
Get the computed inlier ratio used for thresholding in correspondence rejection.
double getMinRatio() const
brief get the minimum overlap ratio
void setMaxRatio(double ratio)
brief set the maximum overlap ratio
CorrespondenceRejectorVarTrimmed()
Empty constructor.
void setInputSource(const typename pcl::PointCloud< PointT >::ConstPtr &cloud)
Provide a source point cloud dataset (must contain XYZ data!), used to compute the correspondence dis...
PointCloud represents the base class in PCL for storing collections of 3D points. ...
bool requiresTargetPoints() const override
See if this rejector requires a target cloud.
void fromPCLPointCloud2(const pcl::PCLPointCloud2 &msg, pcl::PointCloud< PointT > &cloud, const MsgFieldMap &field_map, const std::uint8_t *msg_data)
Convert a PCLPointCloud2 binary data blob into a pcl::PointCloud object using a field_map...
void applyRejection(pcl::Correspondences &correspondences) override
Apply the rejection algorithm.
shared_ptr< DataContainerInterface > Ptr
double getTrimmedDistance() const
Get the trimmed distance used for thresholding in correspondence rejection.
CorrespondencesConstPtr input_correspondences_
The input correspondences.
shared_ptr< const PointCloud< PointT > > ConstPtr
std::string rejection_name_
The name of the rejection method.
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
void setSearchMethodTarget(const typename pcl::search::KdTree< PointT >::Ptr &tree, bool force_no_recompute=false)
Provide a pointer to the search object used to find correspondences in the target cloud...