Exemplo n.º 1
0
template<typename PointT, typename LeafT, typename BranchT, typename OctreeT> void
pcl::octree::OctreePointCloud<PointT, LeafT, BranchT, OctreeT>::addPointFromCloud (const int pointIdx_arg, IndicesPtr indices_arg)
{
  this->addPointIdx (pointIdx_arg);
  if (indices_arg)
    indices_arg->push_back (pointIdx_arg);
}
template <typename PointT> void
pcl::StatisticalMultiscaleInterestRegionExtraction<PointT>::extractExtrema (std::list<IndicesPtr> &rois)
{
  std::vector<std::vector<bool> > is_min (scale_values_.size ()),
      is_max (scale_values_.size ());

  // for each point, check if it is a local extrema on each scale
  for (size_t scale_i = 0; scale_i < scale_values_.size (); ++scale_i)
  {
    std::vector<bool> is_min_scale (input_->points.size ()),
        is_max_scale (input_->points.size ());
    for (size_t point_i = 0; point_i < input_->points.size (); ++point_i)
    {
      std::vector<int> nn_indices;
      geodesicFixedRadiusSearch (point_i, scale_values_[scale_i], nn_indices);
      bool is_max_point = true, is_min_point = true;
      for (std::vector<int>::iterator nn_it = nn_indices.begin (); nn_it != nn_indices.end (); ++nn_it)
        if (F_scales_[scale_i][point_i] < F_scales_[scale_i][*nn_it])
          is_max_point = false;
        else
          is_min_point = false;

      is_min_scale[point_i] = is_min_point;
      is_max_scale[point_i] = is_max_point;
    }

    is_min[scale_i] = is_min_scale;
    is_max[scale_i] = is_max_scale;
  }

  // look for points that are min/max over three consecutive scales
  for (size_t scale_i = 1; scale_i < scale_values_.size () - 1; ++scale_i)
  {
    for (size_t point_i = 0; point_i < input_->points.size (); ++point_i)
      if ((is_min[scale_i - 1][point_i] && is_min[scale_i][point_i] && is_min[scale_i + 1][point_i]) ||
          (is_max[scale_i - 1][point_i] && is_max[scale_i][point_i] && is_max[scale_i + 1][point_i]))
        {
        // add the point to the result vector
        IndicesPtr region (new std::vector<int>);
        region->push_back (static_cast<int> (point_i));

        // and also add its scale-sized geodesic neighborhood
        std::vector<int> nn_indices;
        geodesicFixedRadiusSearch (point_i, scale_values_[scale_i], nn_indices);
        region->insert (region->end (), nn_indices.begin (), nn_indices.end ());
        rois.push_back (region);
      }
  }
}
Exemplo n.º 3
0
 void generateIndices(size_t step = 100)
 {
     indices->clear();
     for(size_t i = 0; i < cloud->points.size(); i += step)
         indices->push_back(i);
 }