点云技术相关产学研社区

 找回密码
 立即注册加入PCL中国点云技术相关产学研社区

扫一扫,访问微社区

查看: 2410|回复: 1

comparePyramidFeatureHistograms函数是干嘛用的

[复制链接]
发表于 2014-9-13 16:38:51 | 显示全部楼层 |阅读模式
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描述符用来匹配
回复

使用道具 举报

发表于 2014-9-17 11:12:55 | 显示全部楼层
template<typename PointFeature>
class pcl::PyramidFeatureHistogram< PointFeature >

Class that compares two sets of features by using a multiscale representation of the features inside a pyramid.

Each level of the pyramid offers information about the similarity of the two feature sets.

Note:
Works with any Point/Feature type which has a PointRepresentation implementation
The only parameters it needs are the input dimension ranges and the output dimension ranges. The input dimension ranges represent the ranges in which each dimension of the feature vector lies. As described in the paper, a minimum inter-vector distance of sqrt(nr_dims)/2 is needed. As such, the target dimension range parameter is used in order to augment/reduce the range for each dimension in order to obtain the necessary minimal inter-vector distance and to add/subtract weight to/from certain dimensions of the feature vector.
Follows the algorithm presented in the publication: Grauman, K. & Darrell, T. The Pyramid Match Kernel: Discriminative Classification with Sets of Image Features Tenth IEEE International Conference on Computer Vision ICCV05 Volume 1 October 2005

Author:
Alexandru-Eugen Ichim
你看这个文献了吗?好好研究下,应该没问题吧。
回复 支持 反对

使用道具 举报

本版积分规则

QQ|小黑屋|点云技术相关产学研社区 ( 陕ICP备13001629号 )

GMT+8, 2024-5-13 02:35 , Processed in 1.254248 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表