#include <pcl/search/brute_force.h>
#include <pcl/common/common.h>
#include <iostream> using namespace std;
using namespace pcl; int main()
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>); // x+y+z=1平面
for (float x = -1.0; x <= 1.0; x += 0.5)
{
for (float y = -1.0; y <= 1.0; y += 0.5)
{
pcl::PointXYZ cloud_;
cloud_.x = x;
cloud_.y = y;
cloud_.z = - x - y;
cloud->push_back(cloud_);
}
} pcl::search::BruteForce<pcl::PointXYZ> bfsearch;
bfsearch.setInputCloud(cloud);
std::vector<int> k_indices;
std::vector<float> k_distances;
pcl::PointXYZ p(-1.0,-1.0,3.0);
bfsearch.nearestKSearch(p,,k_indices,k_distances); return ;
}
 template <typename PointT> int
pcl::search::BruteForce<PointT>::denseKSearch (
const PointT &point, int k, std::vector<int> &k_indices, std::vector<float> &k_distances) const
{
// container for first k elements -> O(1) for insertion, since order not required here
std::vector<Entry> result;
result.reserve (k);
std::priority_queue<Entry> queue; Entry entry;
for (entry.index = ; entry.index < std::min (static_cast<unsigned> (k), static_cast<unsigned> (input_->size ())); ++entry.index)
{
entry.distance = getDistSqr (input_->points[entry.index], point);
result.push_back (entry);
} queue = std::priority_queue<Entry> (result.begin (), result.end ()); // add the rest
for (; entry.index < input_->size (); ++entry.index)
{
entry.distance = getDistSqr (input_->points[entry.index], point);
if (queue.top ().distance > entry.distance)
{
queue.pop ();
queue.push (entry);
}
} k_indices.resize (queue.size ());
k_distances.resize (queue.size ());
size_t idx = queue.size () - ;
while (!queue.empty ())
{
k_indices [idx] = queue.top ().index;
k_distances [idx] = queue.top ().distance;
queue.pop ();
--idx;
} return (static_cast<int> (k_indices.size ()));
}

brute-force search的更多相关文章

  1. nginx 1.3.9/1.4.0 x86 Brute Force Remote Exploit

    测试方法: 本站提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负! #nginx 1.3.9/1.4.0 x86 brute force remote exploit # copyri ...

  2. 常用字符串匹配算法(brute force, kmp, sunday)

    1. 暴力解法 // 暴力求解 int Idx(string S, string T){ // 返回第一个匹配元素的位置,若没有匹配的子串,则返回-1 int S_size = S.length(); ...

  3. 小白日记46:kali渗透测试之Web渗透-SqlMap自动注入(四)-sqlmap参数详解- Enumeration,Brute force,UDF injection,File system,OS,Windows Registry,General,Miscellaneous

    sqlmap自动注入 Enumeration[数据枚举] --privileges -U username[CU 当前账号] -D dvwa -T users -C user --columns  [ ...

  4. SRM 582 Div II Level Three: ColorTheCells, Brute Force 算法

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12581 Burte Force 算法,求解了所有了情况,注意  ...

  5. Test SRM Level Three: LargestCircle, Brute Force

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=3005&rd=5858 思路: 如果直接用Brute F ...

  6. 安全性测试入门:DVWA系列研究(一):Brute Force暴力破解攻击和防御

    写在篇头: 随着国内的互联网产业日臻成熟,软件质量的要求越来越高,对测试团队和测试工程师提出了种种新的挑战. 传统的行业现象是90%的测试工程师被堆积在基本的功能.系统.黑盒测试,但是随着软件测试整体 ...

  7. HDU 6215 Brute Force Sorting(模拟链表 思维)

    Brute Force Sorting Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Othe ...

  8. hdu6215 Brute Force Sorting

    地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6215 题目: Brute Force Sorting Time Limit: 1000/100 ...

  9. HDU - 6215 2017 ACM/ICPC Asia Regional Qingdao Online J - Brute Force Sorting

    Brute Force Sorting Time Limit: 1 Sec  Memory Limit: 128 MB 题目连接 http://acm.hdu.edu.cn/showproblem.p ...

  10. 「暑期训练」「Brute Force」 Restoring Painting (CFR353D2B)

    题意 给定一定条件,问符合的矩阵有几种. 分析 见了鬼了,这破题谁加的brute force的标签,素质极差.因为范围是1e5,那你平方(枚举算法)的复杂度必然爆. 然后你就会思考其中奥妙无穷的数学规 ...

随机推荐

  1. JAVA基础知识之JDBC——ResultSet的滚动和更新(statement的额外参数)

    ResultSet不仅可以内存中的一张二维表一样保存statement执行SQL的结果集,还能通过结果集修改DB的数据.ResultSetMetaData则可以用来获得ResultSet对象的相关信息 ...

  2. web缓存

    web缓存HTTP协议的一个核心特性,它能最小化网络流量,并且提升用户所感知的整个系统响应速度. 什么能被缓存? *Logo和商标图像 *普通的不变化的图像(例如,导航图标) *CSS样式表 *普通的 ...

  3. python走起之第二话

    Python基础 一.整数(int) 如: 18.73.84 整数类的功能方法及举例: 带__的方法代表有多种表达方式 1.__abs__ <==> abs() 求整数的绝对值:(-11) ...

  4. 《BI那点儿事》数据流转换——模糊查找转换

    BI项目中经常会有一些提取,转换,数据处理(ELT)的工作,其中最主要的是处理过赃数据.假设在项目中我们向数据库中注入了测试数据,但是通过一个外键从另外一个表中载入数据的时候没有对应的数据,那么这一行 ...

  5. 从零开始CSS(一 2016/9/21)

    1.基础语法 CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明. selector {declaration1; declaration2; ... declarationN } 选择器通 ...

  6. HDU-4531 吉哥系列故事——乾坤大挪移 模拟

    题意:给定一个九宫格,然后能够选择某行或者是某列滚动,每个小方格分为上下左右四个块,每个块可以涂上4种不同的颜色.问最少使用多少步能够使得所有相同颜色相互联通. 分析:由于九宫格的所有的状态只有9!( ...

  7. boost 编译,windows平台

    下载Boost及生成bjam.exe文件 到Google网站搜索下载boost_1.52版本库,下载完成后,解压到X:下,这个地址自己随便定义.在解压的文件中搜索build.bat文件,把它所在的目录 ...

  8. centos 安装redis自启动要点

    1.redis.conf a.daemonize yes b.pidfile /var/run/xxx.pid 2./etc/init.d/redis //加了下面三个注释部分,才支持设置开机自启动 ...

  9. 【UFLDL】Exercise: Convolutional Neural Network

    这个exercise需要完成cnn中的forward pass,cost,error和gradient的计算.需要弄清楚每一层的以上四个步骤的原理,并且要充分利用matlab的矩阵运算.大概把过程总结 ...

  10. [分享] RT7LITE精简后无法封装解决办法

    eagleonly 发表于 2016-6-9 11:00:01  https://www.itsk.com/forum.php?mod=viewthread&tid=368090&hi ...