Skip to content

Commit af909a6

Browse files
committed
Extend registration&icp to fourth template parameter
1 parent 40fd682 commit af909a6

File tree

6 files changed

+379
-48
lines changed

6 files changed

+379
-48
lines changed

registration/include/pcl/registration/icp.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ namespace pcl
9090
* \author Radu B. Rusu, Michael Dixon
9191
* \ingroup registration
9292
*/
93-
template <typename PointSource, typename PointTarget, typename Scalar = float>
94-
class IterativeClosestPoint : public Registration<PointSource, PointTarget, Scalar>
93+
template <typename PointSource, typename PointTarget, typename Scalar = float,
94+
typename MatrixType = Eigen::Matrix<Scalar,4,4> >
95+
class IterativeClosestPoint : public Registration<PointSource, PointTarget, Scalar, MatrixType>
9596
{
9697
public:
9798
typedef typename Registration<PointSource, PointTarget, Scalar>::PointCloudSource PointCloudSource;
@@ -105,7 +106,7 @@ namespace pcl
105106
typedef PointIndices::Ptr PointIndicesPtr;
106107
typedef PointIndices::ConstPtr PointIndicesConstPtr;
107108

108-
typedef boost::shared_ptr<IterativeClosestPoint<PointSource, PointTarget, Scalar> > Ptr;
109+
typedef boost::shared_ptr<IterativeClosestPoint<PointSource, PointTarget, Scalar, MatrixType> > Ptr;
109110
typedef boost::shared_ptr<const IterativeClosestPoint<PointSource, PointTarget, Scalar> > ConstPtr;
110111

111112
using Registration<PointSource, PointTarget, Scalar>::reg_name_;
@@ -255,14 +256,14 @@ namespace pcl
255256
virtual void
256257
transformCloud (const PointCloudSource &input,
257258
PointCloudSource &output,
258-
const Matrix4 &transform);
259+
const MatrixType &transform);
259260

260261
/** \brief Rigid transformation computation method with initial guess.
261262
* \param output the transformed input point cloud dataset using the rigid transformation found
262263
* \param guess the initial guess of the transformation to compute
263264
*/
264265
virtual void
265-
computeTransformation (PointCloudSource &output, const Matrix4 &guess);
266+
computeTransformation (PointCloudSource &output, const MatrixType &guess);
266267

267268
/** \brief XYZ fields offset. */
268269
size_t x_idx_offset_, y_idx_offset_, z_idx_offset_;
@@ -286,20 +287,21 @@ namespace pcl
286287
* \author Radu B. Rusu
287288
* \ingroup registration
288289
*/
289-
template <typename PointSource, typename PointTarget, typename Scalar = float>
290-
class IterativeClosestPointWithNormals : public IterativeClosestPoint<PointSource, PointTarget, Scalar>
290+
template <typename PointSource, typename PointTarget, typename Scalar = float,
291+
typename MatrixType = Eigen::Matrix<Scalar,4,4> >
292+
class IterativeClosestPointWithNormals : public IterativeClosestPoint<PointSource, PointTarget, Scalar, MatrixType>
291293
{
292294
public:
293-
typedef typename IterativeClosestPoint<PointSource, PointTarget, Scalar>::PointCloudSource PointCloudSource;
294-
typedef typename IterativeClosestPoint<PointSource, PointTarget, Scalar>::PointCloudTarget PointCloudTarget;
295-
typedef typename IterativeClosestPoint<PointSource, PointTarget, Scalar>::Matrix4 Matrix4;
295+
typedef typename IterativeClosestPoint<PointSource, PointTarget, Scalar, MatrixType>::PointCloudSource PointCloudSource;
296+
typedef typename IterativeClosestPoint<PointSource, PointTarget, Scalar, MatrixType>::PointCloudTarget PointCloudTarget;
297+
typedef typename IterativeClosestPoint<PointSource, PointTarget, Scalar, MatrixType>::Matrix4 Matrix4;
296298

297-
using IterativeClosestPoint<PointSource, PointTarget, Scalar>::reg_name_;
298-
using IterativeClosestPoint<PointSource, PointTarget, Scalar>::transformation_estimation_;
299-
using IterativeClosestPoint<PointSource, PointTarget, Scalar>::correspondence_rejectors_;
299+
using IterativeClosestPoint<PointSource, PointTarget, Scalar, MatrixType>::reg_name_;
300+
using IterativeClosestPoint<PointSource, PointTarget, Scalar, MatrixType>::transformation_estimation_;
301+
using IterativeClosestPoint<PointSource, PointTarget, Scalar, MatrixType>::correspondence_rejectors_;
300302

301-
typedef boost::shared_ptr<IterativeClosestPoint<PointSource, PointTarget, Scalar> > Ptr;
302-
typedef boost::shared_ptr<const IterativeClosestPoint<PointSource, PointTarget, Scalar> > ConstPtr;
303+
typedef boost::shared_ptr<IterativeClosestPoint<PointSource, PointTarget, Scalar, MatrixType> > Ptr;
304+
typedef boost::shared_ptr<const IterativeClosestPoint<PointSource, PointTarget, Scalar, MatrixType> > ConstPtr;
303305

304306
/** \brief Empty constructor. */
305307
IterativeClosestPointWithNormals ()
@@ -323,7 +325,7 @@ namespace pcl
323325
virtual void
324326
transformCloud (const PointCloudSource &input,
325327
PointCloudSource &output,
326-
const Matrix4 &transform);
328+
const MatrixType &transform);
327329
};
328330
}
329331

0 commit comments

Comments
 (0)