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&
166 template <
typename Po
intT,
typename NormalT = pcl::Po
intNormal>
184 , input_transformed_ ()
187 , input_normals_transformed_ ()
190 , class_name_ (
"DataContainer")
191 , needs_normals_ (needs_normals)
192 , target_cloud_updated_ (true)
193 , force_no_recompute_ (false)
204 PCL_DEPRECATED (
void setInputCloud (
const PointCloudConstPtr &cloud),
"[pcl::registration::DataContainer::setInputCloud] setInputCloud is deprecated. Please use setInputSource instead.");
207 PCL_DEPRECATED (PointCloudConstPtr
const getInputCloud (),
"[pcl::registration::DataContainer::getInputCloud] getInputCloud is deprecated. Please use getInputSource instead.");
220 inline PointCloudConstPtr
const
231 target_cloud_updated_ =
true;
235 inline PointCloudConstPtr
const
247 bool force_no_recompute =
false)
250 if (force_no_recompute)
252 force_no_recompute_ =
true;
254 target_cloud_updated_ =
true;
264 inline NormalsConstPtr
274 inline NormalsConstPtr
283 if ( target_cloud_updated_ && !force_no_recompute_ )
285 tree_->setInputCloud (target_);
287 std::vector<int> indices (1);
288 std::vector<float> distances (1);
289 if (tree_->nearestKSearch (input_->points[index], 1, indices, distances))
290 return (distances[0]);
292 return (std::numeric_limits<double>::max ());
305 return ((src.getVector4fMap () - tgt.getVector4fMap ()).squaredNorm ());
317 assert (input_normals_ && target_normals_ &&
"Normals are not set for the input and target point clouds");
320 return (
double ((src.normal[0] * tgt.normal[0]) + (src.normal[1] * tgt.normal[1]) + (src.normal[2] * tgt.normal[2])));
325 PointCloudConstPtr input_;
328 PointCloudPtr input_transformed_;
331 PointCloudConstPtr target_;
334 NormalsConstPtr input_normals_;
337 NormalsPtr input_normals_transformed_;
340 NormalsConstPtr target_normals_;
346 std::string class_name_;
353 bool target_cloud_updated_;
357 bool force_no_recompute_;
362 inline const std::string&
363 getClassName ()
const {
return (class_name_); }
368 #include <pcl/registration/impl/correspondence_rejection.hpp>