int main (int, char**) { typedef pcl::PointCloud<pcl::PointXYZ> CloudType; CloudType::Ptr cloud (new CloudType); cloud->is_dense = false; CloudType::Ptr output_cloud (new CloudType); CloudType::PointType p_nan; p_nan.x = std::numeric_limits<float>::quiet_NaN(); p_nan.y = std::numeric_limits<float>::quiet_NaN(); p_nan.z = std::numeric_limits<float>::quiet_NaN(); cloud->push_back(p_nan); CloudType::PointType p_valid; p_valid.x = 1.0f; cloud->push_back(p_valid); std::cout << "size: " << cloud->points.size () << std::endl; std::vector<int> indices; pcl::removeNaNFromPointCloud(*cloud, *output_cloud, indices); std::cout << "size: " << output_cloud->points.size () << std::endl; return 0; }
int main (int argc, char** argv) { typedef pcl::PointXYZRGB PointType; typedef pcl::PointCloud<PointType> CloudType; CloudType::Ptr cloud (new CloudType); CloudType::PointType p; p.x = 1; p.y = 2; p.z = 3; p.r = 5; p.g = 10; p.b = 15; std::cout << p << std::endl; std::cout << p.x << " " << p.y << " " << p.z << " " << static_cast<int>(p.r) << " " << static_cast<int>(p.g) << " " << static_cast<int>(p.b) << std::endl; std::cout << "size: " << cloud->points.size () << std::endl; cloud->push_back(p); return 0; }