I am writing a ransac implementation for use with point clouds, I am aware pcl
also has some but my needs are a bit more specific and writing a custom model in the pcl
style didn't seem very clear.
For this purpose I need to uniformly sample points from the point cloud without replacement, for this purpose I figured I should use pcl::RandomSample
. However, applying this sequentially, example:
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;
}
results in the same indices, which isn't particularly random. What could I be doing wrong?
Edit: With a randomly generated point cloud of 500 elements, the return of the above code, in one case, was
42
145
195
196
290
==========
42
145
195
196
290
Aucun commentaire:
Enregistrer un commentaire