PCL feature extraction and matching (3): feature matching problem solving

Original article: Please indicate the source for reprinting, thank you!

Use the demo in 2 for feature matching,

  1. keypoint-methods (keypoint extraction method) uses Harris3D corner detection,
  2. descriptor-types (feature point description) use FPFH to
    run to
    descriptor_kdtree.nearestKSearch(*source, i, k, k_indices, k_squared_distances);
    correspondences[i] = k_indices[0];
    
    Assertion failed: point_representation_->isValid (point) && "Invalid (NaN, Inf) point coordinates given to nearestKSearch!", file C:\pcl-1.9.1\kdtree\include\pcl/kdtree/impl/kdtree_flann.hpp, line 136Error encountered

Solution

  1. Output the calculated feature descriptor and
    find that there is nan point

    printf("inf1");
    typename pcl::PointCloud<FeatureType>::iterator itr;
    for (itr = source->begin(); itr != source->end(); itr++)
    {
        std::cout << *itr << endl;
    }
    printf("inf2");
    
    (nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan)
    (1.43461, 0.68249, 7.00692, 5.67639, 0.586942, 14.6281, 1.97115, 50.7711, 13.3196, 2.07839, 1.84432, 0.0302716, 6.23244,5.27624, 2.1539, 10.8, 21.7394, 9.44449, 9.60597, 18.2812, 6.65871, 9.77746, 0.8217, 54.9463, 10.4616, 1.65747, 5.87402, 7.36899, 1.68395, 3.46515, 4.46561, 8.38836, 0.866902)
    ...    
    
  2. Remove nan points

Guess you like

Origin www.cnblogs.com/procorosso/p/12695484.html