删除给定框内的点云
Removing point clouds inside a given box
本文关键字:删除 更新时间:2023-10-16
我想实现一个代码,我可以在其中删除给定框中点云的某些点。这是我到目前为止所拥有的:
void removePoints(){
pcl::CropBox<pcl::PointXYZI> boxFilter;
float x_min = -0.15, y_min = -0.5, z_min = -0.7;
float x_max = +1, y_max = +2, z_max = +5;
boxFilter.setMin(Eigen::Vector4f(x_min, y_min, z_min, 1.0));
boxFilter.setMax(Eigen::Vector4f(x_max, y_max, z_max, 1.0));
boxFilter.setInputCloud(cloud);
boxFilter.filter(*newCloud);
viewer->removeAllPointClouds();
cloudLabel=new int[newCloud->size()];
memset(cloudLabel, 0, newCloud->size()*sizeof(int));
ui->label_filename->setText(QString::fromStdString(pointcloudFileName));
colorHandler.setInputCloud(newCloud);
colorHandler.setLabel(cloudLabel);
viewer->addPointCloud<PointT>(newCloud,colorHandler,"cloud",0);
viewer->resetCamera();
viewer->updatePointCloud<PointT>(newCloud,"cloud");
ui->qvtkWidget->update();
std::cout<<"Removal done"<<std::endl;
viewer->addCube(x_min, x_max, y_min, y_max, z_min, z_max, 1, 0, 0, "cube");
viewer->setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR,
0.7, 0.7, 0, "cube");
viewer->setRepresentationToWireframeForAllActors();
}
此代码删除框外的点而不是框内的点。有没有办法反转pcl::CropBox进程?
PCL 中几乎所有的过滤器都继承了 pcl::FilterIndices
,其中公开了函数setNegative
。
使用boxFilter.setNegative(true)
过滤框内的点。
相关文章:
- 将数组的地址分配给变量并删除
- 删除一个线程上有数百万个字符串的大型哈希映射会影响另一个线程的性能
- C/C++编译器通常会删除重复的库吗
- 从链接列表c++中删除一个项目
- C++如何通过用户输入删除列表元素
- 为什么在C++中使用私有复制构造函数与删除复制构造函数
- 是否需要删除包含对象的"pair"?
- 如何在自删除后将对象设置为nullptr
- 迭代时从向量和内存中删除对象
- 使用函数"remove"删除重复元素
- 如何从多映射中删除特定的重复项
- 运算符C++ "delete []"仅删除 2 个前值
- 删除指向指针的指针是运行时错误吗
- 将指针设置为"nullptr"并不能防止双重删除?
- 为什么示例代码访问IUnknown中已删除的内存
- 如何通过 getter 函数删除矢量的元素?
- 从控制台中删除最后打印的元素
- C++中的线程安全删除
- 如何从存储在std::映射中的std::集中删除元素
- 是否有C++编译器选项允许激进地删除所有函数调用,并将参数传递给具有空体的函数