40 #include <pcl/pcl_macros.h>
41 #include <pcl/common/point_tests.h>
42 #include <pcl/filters/filter.h>
45 template <
typename Po
intT>
void
48 std::vector<int> &index)
51 if (&cloud_in != &cloud_out)
59 index.resize (cloud_in.
points.size ());
66 for (std::size_t j = 0; j < cloud_out.
points.size (); ++j)
67 index[j] = static_cast<int>(j);
72 for (std::size_t i = 0; i < cloud_in.
points.size (); ++i)
74 if (!std::isfinite (cloud_in.
points[i].x) ||
75 !std::isfinite (cloud_in.
points[i].y) ||
76 !std::isfinite (cloud_in.
points[i].z))
79 index[j] =
static_cast<int>(i);
82 if (j != cloud_in.
points.size ())
85 cloud_out.
points.resize (j);
90 cloud_out.
width =
static_cast<std::uint32_t
>(j);
98 template <
typename Po
intT>
void
101 std::vector<int> &index)
104 if (&cloud_in != &cloud_out)
112 index.resize (cloud_in.
points.size ());
118 for (std::size_t i = 0; i < cloud_in.
points.size (); ++i)
120 if (!std::isfinite (cloud_in.
points[i].normal_x) ||
121 !std::isfinite (cloud_in.
points[i].normal_y) ||
122 !std::isfinite (cloud_in.
points[i].normal_z))
127 index[j] = static_cast<int>(i);
130 if (j != cloud_in.
points.size ())
133 cloud_out.
points.resize (j);
138 cloud_out.
width =
static_cast<std::uint32_t
>(j);
142 #define PCL_INSTANTIATE_removeNaNFromPointCloud(T) template PCL_EXPORTS void pcl::removeNaNFromPointCloud<T>(const pcl::PointCloud<T>&, pcl::PointCloud<T>&, std::vector<int>&);
143 #define PCL_INSTANTIATE_removeNaNNormalsFromPointCloud(T) template PCL_EXPORTS void pcl::removeNaNNormalsFromPointCloud<T>(const pcl::PointCloud<T>&, pcl::PointCloud<T>&, std::vector<int>&);
void removeNaNNormalsFromPointCloud(const pcl::PointCloud< PointT > &cloud_in, pcl::PointCloud< PointT > &cloud_out, std::vector< int > &index)
Removes points that have their normals invalid (i.e., equal to NaN)
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
void removeNaNFromPointCloud(const pcl::PointCloud< PointT > &cloud_in, pcl::PointCloud< PointT > &cloud_out, std::vector< int > &index)
Removes points with x, y, or z equal to NaN.
std::uint32_t width
The point cloud width (if organized as an image-structure).
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
Eigen::Quaternionf sensor_orientation_
Sensor acquisition pose (rotation).
PointCloud represents the base class in PCL for storing collections of 3D points. ...
Eigen::Vector4f sensor_origin_
Sensor acquisition pose (origin/translation).
std::uint32_t height
The point cloud height (if organized as an image-structure).
bool is_dense
True if no points are invalid (e.g., have NaN or Inf values in any of their floating point fields)...
pcl::PCLHeader header
The point cloud header.