29 labeledCloud.reset(
new pcl::PointCloud<pcl::PointXYZRGBL>());
34 std::cout <<
" Input point cloud size: " << CloudPtr->points.size() <<
" width: " << CloudPtr->width <<
" height: " << CloudPtr->height << std::endl;
35 std::cout <<
" segment mask size: " << segmentImage.size() << std::endl;
37 const int width = CloudPtr->width;
38 const int height = CloudPtr->height;
40 labeledCloud->resize(CloudPtr->points.size());
43 for (
int i = 0; i < height; i++)
45 for (
int j = 0; j < width; j++)
47 labeledCloud->points[i * width + j].x = CloudPtr->points[i * width + j].x;
48 labeledCloud->points[i * width + j].y = CloudPtr->points[i * width + j].y;
49 labeledCloud->points[i * width + j].z = CloudPtr->points[i * width + j].z;
50 labeledCloud->points[i * width + j].r = CloudPtr->points[i * width + j].r;
51 labeledCloud->points[i * width + j].g = CloudPtr->points[i * width + j].g;
52 labeledCloud->points[i * width + j].b = CloudPtr->points[i * width + j].b;
53 labeledCloud->points[i * width + j].label = segmentImage.at(i * width + j);
62 const int width = CloudPtr->width;
63 const int height = CloudPtr->height;
66 for (
int i = 0; i < height; i++)
68 for (
int j = 0; j < width; j++)
70 pcl::PointXYZRGBA& point = CloudPtr->at(i * width + j);
71 rgbImage.push_back(point.r);
72 rgbImage.push_back(point.g);
73 rgbImage.push_back(point.b);