43 #include <pcl/common/io.h>
44 #include <pcl/registration/correspondence_types.h>
45 #include <pcl/search/kdtree.h>
47 #include <pcl/pcl_base.h>
53 namespace registration {
59 template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar =
float>
63 shared_ptr<CorrespondenceEstimationBase<PointSource, PointTarget, Scalar>>;
65 shared_ptr<const CorrespondenceEstimationBase<PointSource, PointTarget, Scalar>>;
148 num_threads_ = nr_threads != 0 ? nr_threads : omp_get_num_procs();
150 if (nr_threads != 1) {
151 PCL_WARN(
"OpenMP is not available. Keeping number of threads unchanged at 1\n");
168 PCL_WARN(
"[pcl::registration::%s::setSourceNormals] This class does not require "
169 "input source normals\n",
184 PCL_WARN(
"[pcl::registration::%s::setTargetNormals] This class does not require "
185 "input target normals\n",
256 bool force_no_recompute =
false)
280 double max_distance = std::numeric_limits<double>::max()) = 0;
293 double max_distance = std::numeric_limits<double>::max()) = 0;
353 inline const std::string&
407 template <
typename Po
intSource,
typename Po
intTarget,
typename Scalar =
float>
411 using Ptr = shared_ptr<CorrespondenceEstimation<PointSource, PointTarget, Scalar>>;
413 shared_ptr<const CorrespondenceEstimation<PointSource, PointTarget, Scalar>>;
463 typename KdTreeReciprocal::PointRepresentationConstPtr;
479 double max_distance = std::numeric_limits<double>::max())
override;
492 double max_distance = std::numeric_limits<double>::max())
override;
508 #include <pcl/registration/impl/correspondence_estimation.hpp>
typename PointRepresentation::ConstPtr PointRepresentationConstPtr
PointCloudConstPtr input_
The input point cloud dataset.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
IndicesPtr indices_
A pointer to the vector of point indices to use.
virtual void setIndices(const IndicesPtr &indices)
Provide a pointer to the vector of indices that represents the input data.
shared_ptr< PointCloud< PointSource > > Ptr
shared_ptr< const PointCloud< PointSource > > ConstPtr
Abstract CorrespondenceEstimationBase class.
void setPointRepresentationReciprocal(const PointRepresentationReciprocalConstPtr &point_representation_reciprocal)
Provide a boost shared pointer to the PointRepresentation for source cloud to be used when searching ...
typename KdTree::PointRepresentationConstPtr PointRepresentationConstPtr
PointCloudTargetPtr input_transformed_
The transformed input source point cloud dataset.
void setNumberOfThreads(unsigned int nr_threads)
Set the number of threads to use.
void setSearchMethodSource(const KdTreeReciprocalPtr &tree, bool force_no_recompute=false)
Provide a pointer to the search object used to find correspondences in the source cloud (usually used...
PointCloudTargetConstPtr target_
The input point cloud dataset target.
PointCloudTargetConstPtr const getInputTarget()
Get a pointer to the input point cloud dataset target.
shared_ptr< const CorrespondenceEstimationBase< PointSource, PointTarget, Scalar > > ConstPtr
bool initCompute()
Internal computation initialization.
virtual void determineReciprocalCorrespondences(pcl::Correspondences &correspondences, double max_distance=std::numeric_limits< double >::max())=0
Determine the reciprocal correspondences between input and target cloud.
IndicesPtr const getIndicesTarget()
Get a pointer to the vector of indices used for the target dataset.
CorrespondenceEstimationBase()
Empty constructor.
const std::string & getClassName() const
Abstract class get name method.
void setPointRepresentation(const PointRepresentationConstPtr &point_representation)
Provide a boost shared pointer to the PointRepresentation for target cloud to be used when searching ...
bool source_cloud_updated_
Variable that stores whether we have a new source cloud, meaning we need to pre-process it again.
typename KdTree::ConstPtr KdTreeConstPtr
typename PointCloudSource::Ptr PointCloudSourcePtr
void setSearchMethodTarget(const KdTreePtr &tree, bool force_no_recompute=false)
Provide a pointer to the search object used to find correspondences in the target cloud.
virtual void setSourceNormals(pcl::PCLPointCloud2::ConstPtr)
Abstract method for setting the source normals.
unsigned int num_threads_
typename PointCloudTarget::ConstPtr PointCloudTargetConstPtr
PointRepresentationReciprocalConstPtr point_representation_reciprocal_
The source point representation used (internal).
typename KdTreeReciprocal::Ptr KdTreeReciprocalPtr
typename KdTreeReciprocal::PointRepresentationConstPtr PointRepresentationReciprocalConstPtr
KdTreeReciprocalPtr getSearchMethodSource() const
Get a pointer to the search method used to find correspondences in the source cloud.
PointRepresentationConstPtr point_representation_
The target point representation used (internal).
IndicesPtr const getIndicesSource()
Get a pointer to the vector of indices used for the source dataset.
void setInputSource(const PointCloudSourceConstPtr &cloud)
Provide a pointer to the input source (e.g., the point cloud that we want to align to the target)
virtual bool requiresTargetNormals() const
See if this rejector requires target normals.
std::vector< pcl::PCLPointField > input_fields_
The types of input point fields available.
virtual bool requiresSourceNormals() const
See if this rejector requires source normals.
std::string corr_name_
The correspondence estimation method name.
void setInputTarget(const PointCloudTargetConstPtr &cloud)
Provide a pointer to the input target (e.g., the point cloud that we want to align the input source t...
virtual CorrespondenceEstimationBase< PointSource, PointTarget, Scalar >::Ptr clone() const =0
Clone and cast to CorrespondenceEstimationBase.
typename PointCloudTarget::Ptr PointCloudTargetPtr
bool target_cloud_updated_
Variable that stores whether we have a new target cloud, meaning we need to pre-process it again.
void setIndicesSource(const IndicesPtr &indices)
Provide a pointer to the vector of indices that represent the input source point cloud.
KdTreePtr tree_
A pointer to the spatial search object used for the target dataset.
typename KdTree::Ptr KdTreePtr
PointCloudSourceConstPtr const getInputSource()
Get a pointer to the input point cloud dataset target.
KdTreeReciprocalPtr tree_reciprocal_
A pointer to the spatial search object used for the source dataset.
virtual void setTargetNormals(pcl::PCLPointCloud2::ConstPtr)
Abstract method for setting the target normals.
typename KdTreeReciprocal::ConstPtr KdTreeReciprocalConstPtr
virtual void determineCorrespondences(pcl::Correspondences &correspondences, double max_distance=std::numeric_limits< double >::max())=0
Determine the correspondences between input and target cloud.
~CorrespondenceEstimationBase() override=default
Empty destructor.
bool initComputeReciprocal()
Internal computation initialization for reciprocal correspondences.
bool force_no_recompute_reciprocal_
A flag which, if set, means the tree operating on the source cloud will never be recomputed.
IndicesPtr target_indices_
The target point cloud dataset indices.
void setIndicesTarget(const IndicesPtr &indices)
Provide a pointer to the vector of indices that represent the input target point cloud.
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
shared_ptr< CorrespondenceEstimationBase< PointSource, PointTarget, Scalar > > Ptr
bool force_no_recompute_
A flag which, if set, means the tree operating on the target cloud will never be recomputed.
KdTreePtr getSearchMethodTarget() const
Get a pointer to the search method used to find correspondences in the target cloud.
CorrespondenceEstimation represents a simple class for determining correspondences between target and...
typename CorrespondenceEstimationBase< PointSource, PointTarget, Scalar >::KdTreeReciprocalPtr KdTreeReciprocalPtr
void determineCorrespondences(pcl::Correspondences &correspondences, double max_distance=std::numeric_limits< double >::max()) override
Determine the correspondences between input and target cloud.
typename KdTreeReciprocal::PointRepresentationConstPtr PointRepresentationReciprocalConstPtr
typename CorrespondenceEstimationBase< PointSource, PointTarget, Scalar >::KdTreeReciprocalConstPtr KdTreeReciprocalConstPtr
CorrespondenceEstimationBase< PointSource, PointTarget, Scalar >::Ptr clone() const override
Clone and cast to CorrespondenceEstimationBase.
typename CorrespondenceEstimationBase< PointSource, PointTarget, Scalar >::KdTree KdTree
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
typename CorrespondenceEstimationBase< PointSource, PointTarget, Scalar >::KdTreeConstPtr KdTreeConstPtr
typename PointCloudSource::Ptr PointCloudSourcePtr
shared_ptr< CorrespondenceEstimation< PointSource, PointTarget, Scalar > > Ptr
void determineReciprocalCorrespondences(pcl::Correspondences &correspondences, double max_distance=std::numeric_limits< double >::max()) override
Determine the reciprocal correspondences between input and target cloud.
shared_ptr< const CorrespondenceEstimation< PointSource, PointTarget, Scalar > > ConstPtr
typename KdTree::PointRepresentationConstPtr PointRepresentationConstPtr
~CorrespondenceEstimation() override=default
Empty destructor.
typename PointCloudTarget::ConstPtr PointCloudTargetConstPtr
typename CorrespondenceEstimationBase< PointSource, PointTarget, Scalar >::KdTreePtr KdTreePtr
typename CorrespondenceEstimationBase< PointSource, PointTarget, Scalar >::KdTreeReciprocal KdTreeReciprocal
CorrespondenceEstimation()
Empty constructor.
typename PointCloudTarget::Ptr PointCloudTargetPtr
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...
shared_ptr< KdTree< PointT, Tree > > Ptr
shared_ptr< const KdTree< PointT, Tree > > ConstPtr
typename PointRepresentation< PointT >::ConstPtr PointRepresentationConstPtr
Defines functions, macros and traits for allocating and using memory.
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
shared_ptr< Indices > IndicesPtr
Defines all the PCL and non-PCL macros used.
shared_ptr< const ::pcl::PCLPointCloud2 > ConstPtr