Skip to content

CorrespondenceEstimation with different point types #329

@aichim

Description

@aichim

Hi guys,

I think I just opened a can of worms in the CorrespondenceEstimation class and it's quite annoying.

So, I am trying to do the following:

  pcl::registration::CorrespondenceEstimation<PointXYZ, pcl::PointNormal> corresp_est;

This initially gave me an error of not being able to convert from PointXYZ to PointNormal in the PCL code, so I hunted for bugs and did the following changes:

diff --git a/registration/include/pcl/registration/correspondence_estimation.h b/registration/include/pcl/registration/correspondence_estimation.h
index ec5422c..ef94383 100644
--- a/registration/include/pcl/registration/correspondence_estimation.h
+++ b/registration/include/pcl/registration/correspondence_estimation.h
@@ -76,7 +76,7 @@ namespace pcl
         typedef typename KdTree::Ptr KdTreePtr;

         typedef pcl::search::KdTree<PointSource> KdTreeReciprocal;
-        typedef typename KdTree::Ptr KdTreeReciprocalPtr;
+        typedef typename KdTreeReciprocal::Ptr KdTreeReciprocalPtr;

         typedef pcl::PointCloud<PointSource> PointCloudSource;
         typedef typename PointCloudSource::Ptr PointCloudSourcePtr;
diff --git a/registration/include/pcl/registration/impl/correspondence_estimation.hpp b/registration/include/pcl/registration/impl/correspondence_estimation.hpp
index 4b02d68..4c2fb8c 100644
--- a/registration/include/pcl/registration/impl/correspondence_estimation.hpp
+++ b/registration/include/pcl/registration/impl/correspondence_estimation.hpp
@@ -142,7 +142,7 @@ pcl::registration::CorrespondenceEstimation<PointSource, PointTarget, Scalar>::d

   // Check if the template types are the same. If true, avoid a copy.
   // Both point types MUST be registered using the POINT_CLOUD_REGISTER_POINT_STRUCT macro!
-  if (isSamePointType<PointSource, PointTarget> ())
+  /*if (isSamePointType<PointSource, PointTarget> ())
   {
     // Iterate over the input set of source indices
     for (std::vector<int>::const_iterator idx = indices_->begin (); idx != indices_->end (); ++idx)
@@ -157,7 +157,7 @@ pcl::registration::CorrespondenceEstimation<PointSource, PointTarget, Scalar>::d
       correspondences[nr_valid_correspondences++] = corr;
     }
   }
-  else
+  else*/
   {
     PointTarget pt;

@@ -212,7 +212,7 @@ pcl::registration::CorrespondenceEstimation<PointSource, PointTarget, Scalar>::d

   // Check if the template types are the same. If true, avoid a copy.
   // Both point types MUST be registered using the POINT_CLOUD_REGISTER_POINT_STRUCT macro!
-  if (isSamePointType<PointSource, PointTarget> ())
+  /*if (isSamePointType<PointSource, PointTarget> ())
   {
     // Iterate over the input set of source indices
     for (std::vector<int>::const_iterator idx = indices_->begin (); idx != indices_->end (); ++idx)
@@ -233,7 +233,7 @@ pcl::registration::CorrespondenceEstimation<PointSource, PointTarget, Scalar>::d
       correspondences[nr_valid_correspondences++] = corr;
     }
   }
-  else
+  else*/
   {
     PointTarget pt_src;
     PointSource pt_tgt;

In the diff above you will also see that I took out the parts where we consider the point types to be the same. I think these tests are wrong, as they are runtime tests, and the compiler is going to compile everything anyway, and will produce errors.

After these changes, I am now getting pages and pages of errors of the form:

/usr/local/include/pcl-1.7/pcl/point_traits.h:137:12: note: definition of 'pcl::traits::datatype<pcl::_PointXYZ,
      pcl::fields::curvature>' is not complete until the closing '}'
    struct datatype : datatype<typename POD<PointT>::type, Tag>

/usr/local/include/pcl-1.7/pcl/registration/impl/correspondence_estimation.hpp:168:7: note: in instantiation of function template
      specialization 'pcl::for_each_type<boost::mpl::vector<pcl::fields::x, pcl::fields::y, pcl::fields::z, pcl::fields::normal_x,
      pcl::fields::normal_y, pcl::fields::normal_z, pcl::fields::curvature, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
      mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, pcl::NdConcatenateFunctor<pcl::PointXYZ, pcl::PointNormal>
      >' requested here
      pcl::for_each_type <FieldListTarget> (pcl::NdConcatenateFunctor <PointSource, PointTarget> (

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions