我用removeNaNFromPointCloud函数处理点云之后,可视化窗口上的点看不见了,但输出点云的size依然和原来一样,indices里面的点和原来一样。请问这可能是什么原因?有什么办法能减少输出点云的size,真正去除无效点,而不仅是不显示?
//输入点云cloud,输出output
for (int i = 0; i < cloud->points.size(); i++) {
cloud->points[i].x = numeric_limits<float>::quiet_NaN();
cloud->points[i].y = numeric_limits<float>::quiet_NaN();
cloud->points[i].z = numeric_limits<float>::quiet_NaN();
}
vector<int> indices;
Cloud9::Ptr output(new Cloud9);//typedef pcl::PointXYZRGBNormal Point9; typedef pcl::PointCloud<Point9> Cloud9;
pcl::removeNaNFromPointCloud(*cloud, *output, indices);
cout << "there are " << output->points.size() << " points" << endl;//输出的图像看不见点了,但size不变
for (int i = 0; i < indices.size(); i++) {
cout << indices[i] << endl;//输出的下标和cloud的完全一样
}