c++ - 返回相同索引的点云的顺序采样
问题描述
我正在编写一个用于点云的 ransac 实现,我知道pcl
也有一些,但我的需求更具体一些,并且以这种pcl
风格编写自定义模型似乎不是很清楚。
为此,我需要从点云中统一采样点而不进行替换,为此我认为我应该使用pcl::RandomSample
. 但是,按顺序应用它,例如:
pcl::RandomSample<pcl::PointXYZRGB> sample(false);
sample.setInputCloud(cloud);
sample.setSample(5);
pcl::Indices indices;
sample.filter(indices);
for (auto &i : indices) {
std::cout << i << std::endl;
}
std::cout << "==========" << std::endl;
indices.clear();
sample.filter(indices);
for (auto &i : indices) {
std::cout << i << std::endl;
}
导致相同的索引,这不是特别随机。我可能做错了什么?
编辑:使用随机生成的 500 个元素的点云,在一种情况下,上述代码的返回是
42
145
195
196
290
==========
42
145
195
196
290
解决方案
推荐阅读
- cordova - 安装 fcm 插件时出现cordova错误
- algorithm - 0 1 背包算法的修改
- android - 关于 Libgdx。如何从设备显示我的图片。(我现在有图片路径)
- python - 如何在.execute方法的cassandra参数中传递不带引号的字符串
- java - 如何将使用 slf4j 实现的日志附加到使用 log4j 实现的日志文件中
- xpath - Xpath 1.0:ancestor-or-self::NameTest/NameTest[predicate] 不像我预期的那样工作
- python-3.x - Python - 在同一 Windows 命令提示符下执行顺序命令
- javascript - 组织许多六边形
- opencv - opencv-3.3.0 在 58% 处停止编译
- node.js - 使用 nodemon 和 babel Express Nodejs 应用程序崩溃而没有错误消息