42 #include <pcl/registration/correspondence_rejection.h>
43 #include <pcl/memory.h>
44 #include <pcl/point_cloud.h>
49 namespace registration
69 using Ptr = shared_ptr<CorrespondenceRejectorSurfaceNormal>;
70 using ConstPtr = shared_ptr<const CorrespondenceRejectorSurfaceNormal>;
76 rejection_name_ =
"CorrespondenceRejectorSurfaceNormal";
98 template <
typename Po
intT,
typename NormalT>
inline void
107 template <
typename Po
intT>
108 PCL_DEPRECATED(1, 12,
"pcl::registration::CorrespondenceRejectorSurfaceNormal::setInputCloud is deprecated. Please use setInputSource instead")
112 if (!data_container_)
114 PCL_ERROR (
"[pcl::registration::%s::setInputCloud] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
123 template <
typename Po
intT>
inline void
126 if (!data_container_)
128 PCL_ERROR (
"[pcl::registration::%s::setInputCloud] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
138 if (!data_container_)
140 PCL_ERROR (
"[pcl::registration::%s::getInputSource] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
149 template <
typename Po
intT>
inline void
152 if (!data_container_)
154 PCL_ERROR (
"[pcl::registration::%s::setInputTarget] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
167 template <
typename Po
intT>
inline void
169 bool force_no_recompute =
false)
172 (data_container_)->setSearchMethodTarget (tree, force_no_recompute );
179 if (!data_container_)
181 PCL_ERROR (
"[pcl::registration::%s::getInputTarget] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
190 template <
typename Po
intT,
typename NormalT>
inline void
193 if (!data_container_)
195 PCL_ERROR (
"[pcl::registration::%s::setInputNormals] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
205 if (!data_container_)
207 PCL_ERROR (
"[pcl::registration::%s::getInputNormals] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
216 template <
typename Po
intT,
typename NormalT>
inline void
219 if (!data_container_)
221 PCL_ERROR (
"[pcl::registration::%s::setTargetNormals] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
231 if (!data_container_)
233 PCL_ERROR (
"[pcl::registration::%s::getTargetNormals] Initialize the data container object by calling intializeDataContainer () before using this function.\n", getClassName ().c_str ());
249 if (!data_container_)
250 initializeDataContainer<PointXYZ, Normal> ();
253 setInputSource<PointXYZ> (cloud);
265 if (!data_container_)
266 initializeDataContainer<PointXYZ, Normal> ();
269 setInputTarget<PointXYZ> (cloud);
281 if (!data_container_)
282 initializeDataContainer<PointXYZ, Normal> ();
285 setInputNormals<PointXYZ, Normal> (cloud);
297 if (!data_container_)
298 initializeDataContainer<PointXYZ, Normal> ();
301 setTargetNormals<PointXYZ, Normal> (cloud);
312 getRemainingCorrespondences (*input_correspondences_, correspondences);
325 #include <pcl/registration/impl/correspondence_rejection_surface_normal.hpp>
shared_ptr< KdTree< PointT, Tree > > Ptr
void fromPCLPointCloud2(const pcl::PCLPointCloud2 &msg, pcl::PointCloud< PointT > &cloud, const MsgFieldMap &field_map)
Convert a PCLPointCloud2 binary data blob into a pcl::PointCloud object using a field_map...
CorrespondenceRejectorSurfaceNormal implements a simple correspondence rejection method based on the ...
shared_ptr< const CorrespondenceRejector > ConstPtr
DataContainer is a container for the input and target point clouds and implements the interface to co...
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...
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< CorrespondenceRejector > Ptr
bool requiresTargetNormals() const override
See if this rejector requires target normals.
CorrespondenceRejector represents the base class for correspondence rejection methods ...
shared_ptr< const ::pcl::PCLPointCloud2 > ConstPtr
bool requiresSourceNormals() const override
See if this rejector requires source normals.
void setSourcePoints(pcl::PCLPointCloud2::ConstPtr cloud2) override
Blob method for setting the source cloud.
void setSourceNormals(pcl::PCLPointCloud2::ConstPtr cloud2) override
Blob method for setting the source normals.
void setThreshold(double threshold)
Set the thresholding angle between the normals for correspondence rejection.
void applyRejection(pcl::Correspondences &correspondences) override
Apply the rejection algorithm.
pcl::PointCloud< NormalT >::Ptr getInputNormals() const
Get the normals computed on the input point cloud.
bool requiresSourcePoints() const override
See if this rejector requires source points.
pcl::PointCloud< PointT >::ConstPtr getInputSource() const
Get the target input point cloud.
void setTargetNormals(const typename pcl::PointCloud< NormalT >::ConstPtr &normals)
Set the normals computed on the target point cloud.
const std::string & getClassName() const
Get a string representation of the name of this class.
DataContainerInterface::Ptr DataContainerPtr
void setInputNormals(const typename pcl::PointCloud< NormalT >::ConstPtr &normals)
Set the normals computed on the input point cloud.
double getThreshold() const
Get the thresholding angle between the normals for correspondence rejection.
void setTargetNormals(pcl::PCLPointCloud2::ConstPtr cloud2) override
Method for setting the target normals.
double threshold_
The median distance threshold between two correspondent points in source <-> target.
void setTargetPoints(pcl::PCLPointCloud2::ConstPtr cloud2) override
Method for setting the target cloud.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
pcl::PointCloud< NormalT >::Ptr getTargetNormals() const
Get the normals computed on the target point cloud.
DataContainerPtr data_container_
A pointer to the DataContainer object containing the input and target point clouds.
shared_ptr< DataContainerInterface > Ptr
CorrespondenceRejectorSurfaceNormal()
Empty constructor.
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
A point structure representing Euclidean xyz coordinates, and the RGB color.
pcl::PointCloud< PointT >::ConstPtr getInputTarget() const
Get the target input point cloud.
void setInputSource(const typename pcl::PointCloud< PointT >::ConstPtr &input)
Provide a source point cloud dataset (must contain XYZ data!), used to compute the correspondence dis...
void initializeDataContainer()
Initialize the data container object for the point type and the normal type.
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...
bool requiresTargetPoints() const override
See if this rejector requires a target cloud.