41 #ifndef PCL_REGISTRATION_CORRESPONDENCE_REJECTION_H_
42 #define PCL_REGISTRATION_CORRESPONDENCE_REJECTION_H_
44 #include <pcl/registration/correspondence_types.h>
45 #include <pcl/registration/correspondence_sorting.h>
46 #include <pcl/console/print.h>
47 #include <pcl/common/transforms.h>
48 #include <pcl/point_cloud.h>
49 #include <pcl/search/kdtree.h>
53 namespace registration
62 typedef boost::shared_ptr<CorrespondenceRejector>
Ptr;
63 typedef boost::shared_ptr<const CorrespondenceRejector>
ConstPtr;
122 std::vector<int>& indices)
126 PCL_WARN (
"[pcl::registration::%s::getRejectedQueryIndices] Input correspondences not set (lookup of rejected correspondences _not_ possible).\n",
getClassName ().c_str ());
134 inline const std::string&
147 PCL_WARN (
"[pcl::registration::%s::setSourcePoints] This class does not require an input source cloud",
getClassName ().c_str ());
159 PCL_WARN (
"[pcl::registration::%s::setSourceNormals] This class does not require input source normals",
getClassName ().c_str ());
170 PCL_WARN (
"[pcl::registration::%s::setTargetPoints] This class does not require an input target cloud",
getClassName ().c_str ());
182 PCL_WARN (
"[pcl::registration::%s::setTargetNormals] This class does not require input target normals",
getClassName ().c_str ());
214 template <
typename Po
intT,
typename NormalT = pcl::Po
intNormal>
232 , input_transformed_ ()
235 , input_normals_transformed_ ()
238 , class_name_ (
"DataContainer")
239 , needs_normals_ (needs_normals)
240 , target_cloud_updated_ (true)
241 , force_no_recompute_ (false)
252 PCL_DEPRECATED (
"[pcl::registration::DataContainer::setInputCloud] setInputCloud is deprecated. Please use setInputSource instead.")
258 PointCloudConstPtr const
272 inline PointCloudConstPtr
const
283 target_cloud_updated_ =
true;
287 inline PointCloudConstPtr
const
299 bool force_no_recompute =
false)
302 if (force_no_recompute)
304 force_no_recompute_ =
true;
306 target_cloud_updated_ =
true;
316 inline NormalsConstPtr
326 inline NormalsConstPtr
335 if ( target_cloud_updated_ && !force_no_recompute_ )
337 tree_->setInputCloud (target_);
339 std::vector<int> indices (1);
340 std::vector<float> distances (1);
341 if (tree_->nearestKSearch (input_->points[index], 1, indices, distances))
342 return (distances[0]);
344 return (std::numeric_limits<double>::max ());
357 return ((src.getVector4fMap () - tgt.getVector4fMap ()).squaredNorm ());
369 assert (input_normals_ && target_normals_ &&
"Normals are not set for the input and target point clouds");
372 return (
double ((src.normal[0] * tgt.normal[0]) + (src.normal[1] * tgt.normal[1]) + (src.normal[2] * tgt.normal[2])));
377 PointCloudConstPtr input_;
380 PointCloudPtr input_transformed_;
383 PointCloudConstPtr target_;
386 NormalsConstPtr input_normals_;
389 NormalsPtr input_normals_transformed_;
392 NormalsConstPtr target_normals_;
398 std::string class_name_;
405 bool target_cloud_updated_;
409 bool force_no_recompute_;
414 inline const std::string&
415 getClassName ()
const {
return (class_name_); }
420 #include <pcl/registration/impl/correspondence_rejection.hpp>