Point Cloud Library (PCL) 1.12.0
Loading...
Searching...
No Matches
registration.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2010-2011, Willow Garage, Inc.
6 * Copyright (c) 2012-, Open Perception, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials provided
19 * with the distribution.
20 * * Neither the name of the copyright holder(s) nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 * $Id$
38 *
39 */
40
41#pragma once
42
43// PCL includes
44#include <pcl/registration/correspondence_estimation.h>
45#include <pcl/registration/correspondence_rejection.h>
46#include <pcl/registration/transformation_estimation.h>
47#include <pcl/search/kdtree.h>
48#include <pcl/memory.h>
49#include <pcl/pcl_base.h>
50#include <pcl/pcl_macros.h>
51
52namespace pcl {
53/** \brief @b Registration represents the base registration class for general purpose,
54 * ICP-like methods. \author Radu B. Rusu, Michael Dixon \ingroup registration
55 */
56template <typename PointSource, typename PointTarget, typename Scalar = float>
57class Registration : public PCLBase<PointSource> {
58public:
59 using Matrix4 = Eigen::Matrix<Scalar, 4, 4>;
60
61 // using PCLBase<PointSource>::initCompute;
62 using PCLBase<PointSource>::deinitCompute;
63 using PCLBase<PointSource>::input_;
64 using PCLBase<PointSource>::indices_;
65
68
71 using KdTreePtr = typename KdTree::Ptr;
72
75
79
83
85
86 using TransformationEstimation = typename pcl::registration::
87 TransformationEstimation<PointSource, PointTarget, Scalar>;
88 using TransformationEstimationPtr = typename TransformationEstimation::Ptr;
89 using TransformationEstimationConstPtr = typename TransformationEstimation::ConstPtr;
90
95
96 /** \brief The callback signature to the function updating intermediate source point
97 * cloud position during it's registration to the target point cloud. \param[in]
98 * cloud_src - the point cloud which will be updated to match target \param[in]
99 * indices_src - a selector of points in cloud_src \param[in] cloud_tgt - the point
100 * cloud we want to register against \param[in] indices_tgt - a selector of points in
101 * cloud_tgt
102 */
104 const pcl::Indices&,
106 const pcl::Indices&);
107
108 /** \brief Empty constructor. */
135
136 /** \brief destructor. */
138
139 /** \brief Provide a pointer to the transformation estimation object.
140 * (e.g., SVD, point to plane etc.)
141 *
142 * \param[in] te is the pointer to the corresponding transformation estimation object
143 *
144 * Code example:
145 *
146 * \code
147 * TransformationEstimationPointToPlaneLLS<PointXYZ, PointXYZ>::Ptr trans_lls
148 * (new TransformationEstimationPointToPlaneLLS<PointXYZ, PointXYZ>);
149 * icp.setTransformationEstimation (trans_lls);
150 * // or...
151 * TransformationEstimationSVD<PointXYZ, PointXYZ>::Ptr trans_svd
152 * (new TransformationEstimationSVD<PointXYZ, PointXYZ>);
153 * icp.setTransformationEstimation (trans_svd);
154 * \endcode
155 */
156 void
161
162 /** \brief Provide a pointer to the correspondence estimation object.
163 * (e.g., regular, reciprocal, normal shooting etc.)
164 *
165 * \param[in] ce is the pointer to the corresponding correspondence estimation object
166 *
167 * Code example:
168 *
169 * \code
170 * CorrespondenceEstimation<PointXYZ, PointXYZ>::Ptr
171 * ce (new CorrespondenceEstimation<PointXYZ, PointXYZ>);
172 * ce->setInputSource (source);
173 * ce->setInputTarget (target);
174 * icp.setCorrespondenceEstimation (ce);
175 * // or...
176 * CorrespondenceEstimationNormalShooting<PointNormal, PointNormal, PointNormal>::Ptr
177 * cens (new CorrespondenceEstimationNormalShooting<PointNormal, PointNormal>);
178 * ce->setInputSource (source);
179 * ce->setInputTarget (target);
180 * ce->setSourceNormals (source);
181 * ce->setTargetNormals (target);
182 * icp.setCorrespondenceEstimation (cens);
183 * \endcode
184 */
185 void
190
191 /** \brief Provide a pointer to the input source
192 * (e.g., the point cloud that we want to align to the target)
193 *
194 * \param[in] cloud the input point cloud source
195 */
196 virtual void
198
199 /** \brief Get a pointer to the input point cloud dataset target. */
200 inline PointCloudSourceConstPtr const
202 {
203 return (input_);
204 }
205
206 /** \brief Provide a pointer to the input target (e.g., the point cloud that we want
207 * to align the input source to) \param[in] cloud the input point cloud target
208 */
209 virtual inline void
211
212 /** \brief Get a pointer to the input point cloud dataset target. */
213 inline PointCloudTargetConstPtr const
215 {
216 return (target_);
217 }
218
219 /** \brief Provide a pointer to the search object used to find correspondences in
220 * the target cloud.
221 * \param[in] tree a pointer to the spatial search object.
222 * \param[in] force_no_recompute If set to true, this tree will NEVER be
223 * recomputed, regardless of calls to setInputTarget. Only use if you are
224 * confident that the tree will be set correctly.
225 */
226 inline void
228 {
229 tree_ = tree;
231 // Since we just set a new tree, we need to check for updates
233 }
234
235 /** \brief Get a pointer to the search method used to find correspondences in the
236 * target cloud. */
237 inline KdTreePtr
239 {
240 return (tree_);
241 }
242
243 /** \brief Provide a pointer to the search object used to find correspondences in
244 * the source cloud (usually used by reciprocal correspondence finding).
245 * \param[in] tree a pointer to the spatial search object.
246 * \param[in] force_no_recompute If set to true, this tree will NEVER be
247 * recomputed, regardless of calls to setInputSource. Only use if you are
248 * extremely confident that the tree will be set correctly.
249 */
250 inline void
252 bool force_no_recompute = false)
253 {
254 tree_reciprocal_ = tree;
256 // Since we just set a new tree, we need to check for updates
258 }
259
260 /** \brief Get a pointer to the search method used to find correspondences in the
261 * source cloud. */
264 {
265 return (tree_reciprocal_);
266 }
267
268 /** \brief Get the final transformation matrix estimated by the registration method.
269 */
270 inline Matrix4
275
276 /** \brief Get the last incremental transformation matrix estimated by the
277 * registration method. */
278 inline Matrix4
283
284 /** \brief Set the maximum number of iterations the internal optimization should run
285 * for. \param[in] nr_iterations the maximum number of iterations the internal
286 * optimization should run for
287 */
288 inline void
293
294 /** \brief Get the maximum number of iterations the internal optimization should run
295 * for, as set by the user. */
296 inline int
298 {
299 return (max_iterations_);
300 }
301
302 /** \brief Set the number of iterations RANSAC should run for.
303 * \param[in] ransac_iterations is the number of iterations RANSAC should run for
304 */
305 inline void
310
311 /** \brief Get the number of iterations RANSAC should run for, as set by the user. */
312 inline double
314 {
315 return (ransac_iterations_);
316 }
317
318 /** \brief Set the inlier distance threshold for the internal RANSAC outlier rejection
319 * loop.
320 *
321 * The method considers a point to be an inlier, if the distance between the target
322 * data index and the transformed source index is smaller than the given inlier
323 * distance threshold. The value is set by default to 0.05m. \param[in]
324 * inlier_threshold the inlier distance threshold for the internal RANSAC outlier
325 * rejection loop
326 */
327 inline void
332
333 /** \brief Get the inlier distance threshold for the internal outlier rejection loop
334 * as set by the user. */
335 inline double
340
341 /** \brief Set the maximum distance threshold between two correspondent points in
342 * source <-> target. If the distance is larger than this threshold, the points will
343 * be ignored in the alignment process. \param[in] distance_threshold the maximum
344 * distance threshold between a point and its nearest neighbor correspondent in order
345 * to be considered in the alignment process
346 */
347 inline void
352
353 /** \brief Get the maximum distance threshold between two correspondent points in
354 * source <-> target. If the distance is larger than this threshold, the points will
355 * be ignored in the alignment process.
356 */
357 inline double
362
363 /** \brief Set the transformation epsilon (maximum allowable translation squared
364 * difference between two consecutive transformations) in order for an optimization to
365 * be considered as having converged to the final solution. \param[in] epsilon the
366 * transformation epsilon in order for an optimization to be considered as having
367 * converged to the final solution.
368 */
369 inline void
374
375 /** \brief Get the transformation epsilon (maximum allowable translation squared
376 * difference between two consecutive transformations) as set by the user.
377 */
378 inline double
383
384 /** \brief Set the transformation rotation epsilon (maximum allowable rotation
385 * difference between two consecutive transformations) in order for an optimization to
386 * be considered as having converged to the final solution. \param[in] epsilon the
387 * transformation rotation epsilon in order for an optimization to be considered as
388 * having converged to the final solution (epsilon is the cos(angle) in a axis-angle
389 * representation).
390 */
391 inline void
396
397 /** \brief Get the transformation rotation epsilon (maximum allowable difference
398 * between two consecutive transformations) as set by the user (epsilon is the
399 * cos(angle) in a axis-angle representation).
400 */
401 inline double
406
407 /** \brief Set the maximum allowed Euclidean error between two consecutive steps in
408 * the ICP loop, before the algorithm is considered to have converged. The error is
409 * estimated as the sum of the differences between correspondences in an Euclidean
410 * sense, divided by the number of correspondences. \param[in] epsilon the maximum
411 * allowed distance error before the algorithm will be considered to have converged
412 */
413 inline void
418
419 /** \brief Get the maximum allowed distance error before the algorithm will be
420 * considered to have converged, as set by the user. See \ref
421 * setEuclideanFitnessEpsilon
422 */
423 inline double
428
429 /** \brief Provide a boost shared pointer to the PointRepresentation to be used when
430 * comparing points \param[in] point_representation the PointRepresentation to be used
431 * by the k-D tree
432 */
433 inline void
438
439 /** \brief Register the user callback function which will be called from registration
440 * thread in order to update point cloud obtained after each iteration \param[in]
441 * visualizerCallback reference of the user callback function
442 */
443 inline bool
445 std::function<UpdateVisualizerCallbackSignature>& visualizerCallback)
446 {
447 if (visualizerCallback) {
449 return (true);
450 }
451 return (false);
452 }
453
454 /** \brief Obtain the Euclidean fitness score (e.g., mean of squared distances from
455 * the source to the target) \param[in] max_range maximum allowable distance between a
456 * point and its correspondence in the target (default: double::max)
457 */
458 inline double
459 getFitnessScore(double max_range = std::numeric_limits<double>::max());
460
461 /** \brief Obtain the Euclidean fitness score (e.g., mean of squared distances from
462 * the source to the target) from two sets of correspondence distances (distances
463 * between source and target points) \param[in] distances_a the first set of distances
464 * between correspondences \param[in] distances_b the second set of distances between
465 * correspondences
466 */
467 inline double
468 getFitnessScore(const std::vector<float>& distances_a,
469 const std::vector<float>& distances_b);
470
471 /** \brief Return the state of convergence after the last align run */
472 inline bool
474 {
475 return (converged_);
476 }
477
478 /** \brief Call the registration algorithm which estimates the transformation and
479 * returns the transformed source (input) as \a output. \param[out] output the
480 * resultant input transformed point cloud dataset
481 */
482 inline void
484
485 /** \brief Call the registration algorithm which estimates the transformation and
486 * returns the transformed source (input) as \a output. \param[out] output the
487 * resultant input transformed point cloud dataset \param[in] guess the initial gross
488 * estimation of the transformation
489 */
490 inline void
492
493 /** \brief Abstract class get name method. */
494 inline const std::string&
496 {
497 return (reg_name_);
498 }
499
500 /** \brief Internal computation initialization. */
501 bool
502 initCompute();
503
504 /** \brief Internal computation when reciprocal lookup is needed */
505 bool
507
508 /** \brief Add a new correspondence rejector to the list
509 * \param[in] rejector the new correspondence rejector to concatenate
510 *
511 * Code example:
512 *
513 * \code
514 * CorrespondenceRejectorDistance rej;
515 * rej.setInputCloud<PointXYZ> (keypoints_src);
516 * rej.setInputTarget<PointXYZ> (keypoints_tgt);
517 * rej.setMaximumDistance (1);
518 * rej.setInputCorrespondences (all_correspondences);
519 *
520 * // or...
521 *
522 * \endcode
523 */
524 inline void
529
530 /** \brief Get the list of correspondence rejectors. */
531 inline std::vector<CorrespondenceRejectorPtr>
536
537 /** \brief Remove the i-th correspondence rejector in the list
538 * \param[in] i the position of the correspondence rejector in the list to remove
539 */
540 inline bool
542 {
544 return (false);
546 return (true);
547 }
548
549 /** \brief Clear the list of correspondence rejectors. */
550 inline void
555
556protected:
557 /** \brief The registration method name. */
558 std::string reg_name_;
559
560 /** \brief A pointer to the spatial search object. */
562
563 /** \brief A pointer to the spatial search object of the source. */
565
566 /** \brief The number of iterations the internal optimization ran for (used
567 * internally). */
569
570 /** \brief The maximum number of iterations the internal optimization should run for.
571 * The default value is 10.
572 */
574
575 /** \brief The number of iterations RANSAC should run for. */
577
578 /** \brief The input point cloud dataset target. */
580
581 /** \brief The final transformation matrix estimated by the registration method after
582 * N iterations. */
584
585 /** \brief The transformation matrix estimated by the registration method. */
587
588 /** \brief The previous transformation matrix estimated by the registration method
589 * (used internally). */
591
592 /** \brief The maximum difference between two consecutive transformations in order to
593 * consider convergence (user defined).
594 */
596
597 /** \brief The maximum rotation difference between two consecutive transformations in
598 * order to consider convergence (user defined).
599 */
601
602 /** \brief The maximum allowed Euclidean error between two consecutive steps in the
603 * ICP loop, before the algorithm is considered to have converged. The error is
604 * estimated as the sum of the differences between correspondences in an Euclidean
605 * sense, divided by the number of correspondences.
606 */
608
609 /** \brief The maximum distance threshold between two correspondent points in source
610 * <-> target. If the distance is larger than this threshold, the points will be
611 * ignored in the alignment process.
612 */
614
615 /** \brief The inlier distance threshold for the internal RANSAC outlier rejection
616 * loop. The method considers a point to be an inlier, if the distance between the
617 * target data index and the transformed source index is smaller than the given inlier
618 * distance threshold. The default value is 0.05.
619 */
621
622 /** \brief Holds internal convergence state, given user parameters. */
624
625 /** \brief The minimum number of correspondences that the algorithm needs before
626 * attempting to estimate the transformation. The default value is 3.
627 */
629
630 /** \brief The set of correspondences determined at this ICP step. */
632
633 /** \brief A TransformationEstimation object, used to calculate the 4x4 rigid
634 * transformation. */
636
637 /** \brief A CorrespondenceEstimation object, used to estimate correspondences between
638 * the source and the target cloud. */
640
641 /** \brief The list of correspondence rejectors to use. */
642 std::vector<CorrespondenceRejectorPtr> correspondence_rejectors_;
643
644 /** \brief Variable that stores whether we have a new target cloud, meaning we need to
645 * pre-process it again. This way, we avoid rebuilding the kd-tree for the target
646 * cloud every time the determineCorrespondences () method is called. */
648 /** \brief Variable that stores whether we have a new source cloud, meaning we need to
649 * pre-process it again. This way, we avoid rebuilding the reciprocal kd-tree for the
650 * source cloud every time the determineCorrespondences () method is called. */
652 /** \brief A flag which, if set, means the tree operating on the target cloud
653 * will never be recomputed*/
655
656 /** \brief A flag which, if set, means the tree operating on the source cloud
657 * will never be recomputed*/
659
660 /** \brief Callback function to update intermediate source point cloud position during
661 * it's registration to the target point cloud.
662 */
663 std::function<UpdateVisualizerCallbackSignature> update_visualizer_;
664
665 /** \brief Search for the closest nearest neighbor of a given point.
666 * \param cloud the point cloud dataset to use for nearest neighbor search
667 * \param index the index of the query point
668 * \param indices the resultant vector of indices representing the k-nearest neighbors
669 * \param distances the resultant distances from the query point to the k-nearest
670 * neighbors
671 */
672 inline bool
674 int index,
675 pcl::Indices& indices,
676 std::vector<float>& distances)
677 {
678 int k = tree_->nearestKSearch(cloud, index, 1, indices, distances);
679 if (k == 0)
680 return (false);
681 return (true);
682 }
683
684 /** \brief Abstract transformation computation method with initial guess */
685 virtual void
687
688private:
689 /** \brief The point representation used (internal). */
690 PointRepresentationConstPtr point_representation_;
691
692 /**
693 * \brief Remove from public API in favor of \ref setInputSource
694 *
695 * Still gives the correct result (with a warning)
696 */
697 void
698 setInputCloud(const PointCloudSourceConstPtr& cloud) override
699 {
700 PCL_WARN("[pcl::registration::Registration] setInputCloud is deprecated."
701 "Please use setInputSource instead.\n");
702 setInputSource(cloud);
703 }
704
705public:
707};
708} // namespace pcl
709
710#include <pcl/registration/impl/registration.hpp>
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
PCL base class.
Definition pcl_base.h:70
PointCloudConstPtr input_
The input point cloud dataset.
Definition pcl_base.h:147
IndicesPtr indices_
A pointer to the vector of point indices to use.
Definition pcl_base.h:150
bool deinitCompute()
This method should get called after finishing the actual computation.
Definition pcl_base.hpp:174
shared_ptr< PointCloud< PointSource > > Ptr
shared_ptr< const PointCloud< PointSource > > ConstPtr
Registration represents the base registration class for general purpose, ICP-like methods.
bool target_cloud_updated_
Variable that stores whether we have a new target cloud, meaning we need to pre-process it again.
Matrix4 final_transformation_
The final transformation matrix estimated by the registration method after N iterations.
typename KdTreeReciprocal::Ptr KdTreeReciprocalPtr
bool initCompute()
Internal computation initialization.
std::function< UpdateVisualizerCallbackSignature > update_visualizer_
Callback function to update intermediate source point cloud position during it's registration to the ...
virtual 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)
double corr_dist_threshold_
The maximum distance threshold between two correspondent points in source <-> target.
void clearCorrespondenceRejectors()
Clear the list of correspondence rejectors.
double getTransformationEpsilon()
Get the transformation epsilon (maximum allowable translation squared difference between two consecut...
typename pcl::registration:: TransformationEstimation< PointSource, PointTarget, Scalar > TransformationEstimation
std::string reg_name_
The registration method name.
Matrix4 getFinalTransformation()
Get the final transformation matrix estimated by the registration method.
void setRANSACIterations(int ransac_iterations)
Set the number of iterations RANSAC should run for.
Matrix4 transformation_
The transformation matrix estimated by the registration method.
pcl::PointCloud< PointSource > PointCloudSource
KdTreeReciprocalPtr tree_reciprocal_
A pointer to the spatial search object of the source.
bool removeCorrespondenceRejector(unsigned int i)
Remove the i-th correspondence rejector in the list.
void setCorrespondenceEstimation(const CorrespondenceEstimationPtr &ce)
Provide a pointer to the correspondence estimation object.
typename CorrespondenceEstimation::ConstPtr CorrespondenceEstimationConstPtr
void setMaximumIterations(int nr_iterations)
Set the maximum number of iterations the internal optimization should run for.
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...
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.
typename PointCloudSource::ConstPtr PointCloudSourceConstPtr
typename KdTree::Ptr KdTreePtr
virtual 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...
bool registerVisualizationCallback(std::function< UpdateVisualizerCallbackSignature > &visualizerCallback)
Register the user callback function which will be called from registration thread in order to update ...
typename TransformationEstimation::Ptr TransformationEstimationPtr
typename PointCloudSource::Ptr PointCloudSourcePtr
void setPointRepresentation(const PointRepresentationConstPtr &point_representation)
Provide a boost shared pointer to the PointRepresentation to be used when comparing points.
CorrespondenceEstimationPtr correspondence_estimation_
A CorrespondenceEstimation object, used to estimate correspondences between the source and the target...
typename PointCloudTarget::ConstPtr PointCloudTargetConstPtr
double getTransformationRotationEpsilon()
Get the transformation rotation epsilon (maximum allowable difference between two consecutive transfo...
bool force_no_recompute_
A flag which, if set, means the tree operating on the target cloud will never be recomputed.
void setRANSACOutlierRejectionThreshold(double inlier_threshold)
Set the inlier distance threshold for the internal RANSAC outlier rejection loop.
void setMaxCorrespondenceDistance(double distance_threshold)
Set the maximum distance threshold between two correspondent points in source <-> target.
void addCorrespondenceRejector(const CorrespondenceRejectorPtr &rejector)
Add a new correspondence rejector to the list.
int nr_iterations_
The number of iterations the internal optimization ran for (used internally).
double getRANSACOutlierRejectionThreshold()
Get the inlier distance threshold for the internal outlier rejection loop as set by the user.
double getEuclideanFitnessEpsilon()
Get the maximum allowed distance error before the algorithm will be considered to have converged,...
double getMaxCorrespondenceDistance()
Get the maximum distance threshold between two correspondent points in source <-> target.
KdTreePtr getSearchMethodTarget() const
Get a pointer to the search method used to find correspondences in the target cloud.
KdTreePtr tree_
A pointer to the spatial search object.
shared_ptr< Registration< PointSource, PointTarget, Scalar > > Ptr
Registration()
Empty constructor.
Matrix4 getLastIncrementalTransformation()
Get the last incremental transformation matrix estimated by the registration method.
typename PointCloudTarget::Ptr PointCloudTargetPtr
Matrix4 previous_transformation_
The previous transformation matrix estimated by the registration method (used internally).
bool converged_
Holds internal convergence state, given user parameters.
int ransac_iterations_
The number of iterations RANSAC should run for.
Eigen::Matrix< Scalar, 4, 4 > Matrix4
void align(PointCloudSource &output)
Call the registration algorithm which estimates the transformation and returns the transformed source...
PointCloudTargetConstPtr const getInputTarget()
Get a pointer to the input point cloud dataset target.
CorrespondencesPtr correspondences_
The set of correspondences determined at this ICP step.
TransformationEstimationPtr transformation_estimation_
A TransformationEstimation object, used to calculate the 4x4 rigid transformation.
bool searchForNeighbors(const PointCloudSource &cloud, int index, pcl::Indices &indices, std::vector< float > &distances)
Search for the closest nearest neighbor of a given point.
int max_iterations_
The maximum number of iterations the internal optimization should run for.
double transformation_rotation_epsilon_
The maximum rotation difference between two consecutive transformations in order to consider converge...
double getFitnessScore(double max_range=std::numeric_limits< double >::max())
Obtain the Euclidean fitness score (e.g., mean of squared distances from the source to the target)
double euclidean_fitness_epsilon_
The maximum allowed Euclidean error between two consecutive steps in the ICP loop,...
double inlier_threshold_
The inlier distance threshold for the internal RANSAC outlier rejection loop.
~Registration()
destructor.
pcl::registration::CorrespondenceRejector::Ptr CorrespondenceRejectorPtr
PointCloudSourceConstPtr const getInputSource()
Get a pointer to the input point cloud dataset target.
typename TransformationEstimation::ConstPtr TransformationEstimationConstPtr
bool hasConverged() const
Return the state of convergence after the last align run.
typename KdTree::PointRepresentationConstPtr PointRepresentationConstPtr
void setTransformationEstimation(const TransformationEstimationPtr &te)
Provide a pointer to the transformation estimation object.
bool force_no_recompute_reciprocal_
A flag which, if set, means the tree operating on the source cloud will never be recomputed.
double transformation_epsilon_
The maximum difference between two consecutive transformations in order to consider convergence (user...
std::vector< CorrespondenceRejectorPtr > getCorrespondenceRejectors()
Get the list of correspondence rejectors.
std::vector< CorrespondenceRejectorPtr > correspondence_rejectors_
The list of correspondence rejectors to use.
KdTreeReciprocalPtr getSearchMethodSource() const
Get a pointer to the search method used to find correspondences in the source cloud.
int getMaximumIterations()
Get the maximum number of iterations the internal optimization should run for, as set by the user.
void setTransformationRotationEpsilon(double epsilon)
Set the transformation rotation epsilon (maximum allowable rotation difference between two consecutiv...
bool initComputeReciprocal()
Internal computation when reciprocal lookup is needed.
int min_number_correspondences_
The minimum number of correspondences that the algorithm needs before attempting to estimate the tran...
virtual void computeTransformation(PointCloudSource &output, const Matrix4 &guess)=0
Abstract transformation computation method with initial guess.
void(const pcl::PointCloud< PointSource > &, const pcl::Indices &, const pcl::PointCloud< PointTarget > &, const pcl::Indices &) UpdateVisualizerCallbackSignature
The callback signature to the function updating intermediate source point cloud position during it's ...
typename CorrespondenceEstimation::Ptr CorrespondenceEstimationPtr
void setEuclideanFitnessEpsilon(double epsilon)
Set the maximum allowed Euclidean error between two consecutive steps in the ICP loop,...
void setTransformationEpsilon(double epsilon)
Set the transformation epsilon (maximum allowable translation squared difference between two consecut...
bool source_cloud_updated_
Variable that stores whether we have a new source cloud, meaning we need to pre-process it again.
PointCloudTargetConstPtr target_
The input point cloud dataset target.
const std::string & getClassName() const
Abstract class get name method.
double getRANSACIterations()
Get the number of iterations RANSAC should run for, as set by the user.
Abstract CorrespondenceEstimationBase class.
shared_ptr< const CorrespondenceEstimationBase< PointSource, PointTarget, Scalar > > ConstPtr
shared_ptr< CorrespondenceEstimationBase< PointSource, PointTarget, Scalar > > Ptr
shared_ptr< CorrespondenceRejector > Ptr
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...
Definition kdtree.h:62
shared_ptr< KdTree< PointT, Tree > > Ptr
Definition kdtree.h:75
typename PointRepresentation< PointT >::ConstPtr PointRepresentationConstPtr
Definition kdtree.h:80
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition memory.h:63
Defines functions, macros and traits for allocating and using memory.
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
shared_ptr< Correspondences > CorrespondencesPtr
Defines all the PCL and non-PCL macros used.