pcl nearestKSearch

/** \brief Search for the k-nearest neighbors for the given query point.
          * \param[in] point the given query point
          * \param[in] k the number of neighbors to search for
          * \param[out] k_indices the resultant indices of the neighboring points (must be resized to \a k a priori!)
          * \param[out] k_sqr_distances the resultant squared distances to the neighboring points (must be resized to \a k
          * a priori!)
          * \return number of neighbors found
          */
        int
        nearestKSearch (const PointT &point, int k, 
                        std::vector<int> &k_indices, 
                        std::vector<float> &k_sqr_distances) const;

param:
point:以这个传入的点为基准,基准点。
k:取几个离基本点最近的点
k_indices:这几个K点的下脚标
k_sqr_distances:这几个K点对于基准点的距离

    /*
     * \brief Search for the closest nearest neighbor of a given point.
     * \param query the point to search a nearest neighbour for
     * \param index vector of size 1 to store the index of the nearest neighbour found 给1个空间的vector去储存这个找到的最近点的脚标(因为之保留最近的那个点)
     * \param distance vector of size 1 to store the distance to nearest neighbour found 给1个空间的vector去储存找到的最近点的距离
     */
     
    inline bool searchForNeighbors(const PointSource& query, std::vector<int>& index, std::vector<float>& distance) const
    {
        //只搜索一个最近点和距离
        int k=tree_->nearestKSearch(query,1,index,distance);
    }
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值