pcl::PyramidFeatureHistogram<PointFeature>::comparePyramidFeatureHistograms (const PyramidFeatureHistogramPtr &pyramid_a,
const PyramidFeatureHistogramPtr &pyramid_b)
{
// do a few consistency checks before and during the computation
if (pyramid_a->nr_dimensions != pyramid_b->nr_dimensions)
{
PCL_ERROR ("[pcl::PyramidFeatureMatching::comparePyramidFeatureHistograms] The two given pyramids have different numbers of dimensions: %u vs %u\n", pyramid_a->nr_dimensions, pyramid_b->nr_dimensions);
return -1;
}
if (pyramid_a->nr_levels != pyramid_b->nr_levels)
{
PCL_ERROR ("[pcl::PyramidFeatureMatching::comparePyramidFeatureHistograms] The two given pyramids have different numbers of levels: %u vs %u\n", pyramid_a->nr_levels, pyramid_b->nr_levels);
return -1;
}
// calculate for level 0 first
if (pyramid_a->hist_levels[0].hist.size () != pyramid_b->hist_levels[0].hist.size ())
{
PCL_ERROR ("[pcl::PyramidFeatureMatching::comparePyramidFeatureHistograms] The two given pyramids have different numbers of bins on level 0: %u vs %u\n", pyramid_a->hist_levels[0].hist.size (), pyramid_b->hist_levels[0].hist.size ());
return -1;
}
float match_count_level = 0.0f, match_count_prev_level = 0.0f;
for (size_t bin_i = 0; bin_i < pyramid_a->hist_levels[0].hist.size (); ++bin_i)
{
if (pyramid_a->hist_levels[0].hist[bin_i] < pyramid_b->hist_levels[0].hist[bin_i])
match_count_level += static_cast<float> (pyramid_a->hist_levels[0].hist[bin_i]);
else
match_count_level += static_cast<float> (pyramid_b->hist_levels[0].hist[bin_i]);
}
float match_count = match_count_level;
for (size_t level_i = 1; level_i < pyramid_a->nr_levels; ++level_i)
{
if (pyramid_a->hist_levels[level_i].hist.size () != pyramid_b->hist_levels[level_i].hist.size ())
{
PCL_ERROR ("[pcl::PyramidFeatureMatching::comparePyramidFeatureHistograms] The two given pyramids have different numbers of bins on level %u: %u vs %u\n", level_i, pyramid_a->hist_levels[level_i].hist.size (), pyramid_b->hist_levels[level_i].hist.size ());
return -1;
}
match_count_prev_level = match_count_level;
match_count_level = 0.0f;
for (size_t bin_i = 0; bin_i < pyramid_a->hist_levels[level_i].hist.size (); ++bin_i)
{
if (pyramid_a->hist_levels[level_i].hist[bin_i] < pyramid_b->hist_levels[level_i].hist[bin_i])
match_count_level += static_cast<float> (pyramid_a->hist_levels[level_i].hist[bin_i]);
else
match_count_level += static_cast<float> (pyramid_b->hist_levels[level_i].hist[bin_i]);
}
float level_normalization_factor = powf (2.0f, static_cast<float> (level_i));
match_count += (match_count_level - match_count_prev_level) / level_normalization_factor;
}
// include self-similarity factors
float self_similarity_a = static_cast<float> (pyramid_a->nr_features),
self_similarity_b = static_cast<float> (pyramid_b->nr_features);
PCL_DEBUG ("[pcl::PyramidFeatureMatching::comparePyramidFeatureHistograms] Self similarity measures: %f, %f\n", self_similarity_a, self_similarity_b);
match_count /= sqrtf (self_similarity_a * self_similarity_b);
return match_count;
}
这个函数是干嘛用的,麻烦高手指教,此函数位于PCL\include\pcl-1.7\pcl\registration\impl\pyramid_feature_matching.hpp内,这个能不能将提取的FPFH描述符用来匹配
|