报错 类不能是其自身的基类
因为pcl::concatenateFields与PointXYZRGB不兼容
viewer.reset(new pcl::visualization::PCLVisualizer("viewer", false));
vtkNew<vtkGenericOpenGLRenderWindow> window;
window->AddRenderer(viewer->getRendererCollection()->GetFirstRenderer());
ui->openGLWidget->setRenderWindow(window.Get());
viewer->addPointCloud<pcl::PointXYZRGB>(cloud.makeShared(),std::to_string(cloud.size()-1));
//设置点云大小
viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, point_size, std::to_string(cloud.size()-1));
viewer->resetCamera();
ui->openGLWidget->update();
在openGLwidget创建时传入的点云格式是PointXYZRGB的
只需要新建一个PointXYZ的点云cloud_XYZ XYZ继承cloud
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_xyz(new pcl::PointCloud<pcl::PointXYZ>);
cloud_xyz->width = cloud.width;
cloud_xyz->height = cloud.height;
cloud_xyz->is_dense = cloud.is_dense;
cloud_xyz->points.resize(cloud.points.size());
for (size_t i = 0; i < cloud.points.size(); ++i) {
cloud_xyz->points[i].x = cloud.points[i].x;
cloud_xyz->points[i].y = cloud.points[i].y;
cloud_xyz->points[i].z = cloud.points[i].z;
}
标签:QT,viewer,xyz,oncatenateFields,points,报错,pcl,cloud,size
From: https://blog.csdn.net/m0_44995542/article/details/139510376