11 pcl::PointCloud<pcl::PointXYZ>::Ptr
pointCloudFromNxLib(NxLibItem
const& node, std::string
const& frame,
16 std::vector<float> data;
18 node.getBinaryDataInfo(&width, &height, 0, 0, 0, ×tamp);
19 node.getBinaryData(data, 0);
21 auto cloud = boost::make_shared<pcl::PointCloud<pcl::PointXYZ>>();
25 cloud->header.frame_id = frame;
28 cloud->height = height;
29 cloud->is_dense =
false;
30 cloud->points.resize(width * height);
31 for (
int i = 0; i < width * height; i++)
33 cloud->points[i].x = data[3 * i] / 1000.0f;
34 cloud->points[i].y = data[3 * i + 1] / 1000.0f;
35 cloud->points[i].z = data[3 * i + 2] / 1000.0f;
37 if (roi != 0 && !roi->
contains(cloud->points[i].x, cloud->points[i].y, cloud->points[i].z))
39 cloud->points[i].x = std::numeric_limits<float>::quiet_NaN();
40 cloud->points[i].y = std::numeric_limits<float>::quiet_NaN();
41 cloud->points[i].z = std::numeric_limits<float>::quiet_NaN();
49 NxLibItem
const& normalNode,
50 std::string
const& frame,
55 std::vector<float> pointData;
56 std::vector<float> normalData;
58 pointMapNode.getBinaryDataInfo(&width, &height, 0, 0, 0, ×tamp);
59 pointMapNode.getBinaryData(pointData, 0);
60 normalNode.getBinaryData(normalData, 0);
62 auto cloud = boost::make_shared<pcl::PointCloud<pcl::PointNormal>>();
66 cloud->header.frame_id = frame;
69 cloud->height = height;
70 cloud->is_dense =
false;
71 cloud->points.resize(width * height);
72 for (
int i = 0; i < width * height; i++)
75 cloud->points[i].x = pointData[3 * i] / 1000.0f;
76 cloud->points[i].y = pointData[3 * i + 1] / 1000.0f;
77 cloud->points[i].z = pointData[3 * i + 2] / 1000.0f;
79 if (roi != 0 && !roi->
contains(cloud->points[i].x, cloud->points[i].y, cloud->points[i].z))
81 cloud->points[i].x = std::numeric_limits<float>::quiet_NaN();
82 cloud->points[i].y = std::numeric_limits<float>::quiet_NaN();
83 cloud->points[i].z = std::numeric_limits<float>::quiet_NaN();
87 cloud->points[i].normal_x = normalData[3 * i];
88 cloud->points[i].normal_y = normalData[3 * i + 1];
89 cloud->points[i].normal_z = normalData[3 * i + 2];
pcl::PointCloud< pcl::PointXYZ >::Ptr pointCloudFromNxLib(NxLibItem const &node, std::string const &frame, PointCloudROI const *roi)
double const NXLIB_TIMESTAMP_OFFSET
pcl::PointCloud< pcl::PointNormal >::Ptr pointCloudWithNormalsFromNxLib(NxLibItem const &pointMapNode, NxLibItem const &normalNode, std::string const &frame, PointCloudROI const *roi)
bool contains(float x, float y, float z) const