0
我下载了velodyne-32E lIDAR的样本pcap,并将其中一个帧保存为csv文件。使用PCL,我想将点云可视化为一个距离图像以及与其进行交互以进行进一步处理(摄像机 - 激光雷达校准)。到目前为止,我遵循教程并将垂直/水平角分辨率分别设置为.16和1.33度。点云看起来不错,但生成的图像非常小,我不认为我能看到任何东西。PCL(点云库)范围图像太小
由于我使用的是RangeImageVisualiser
而不是PCLVisualiser
,因此我似乎没有在这里给出任何控件。任何想法如何让我的形象更可视?
ifstream file (argv[1]);
float x,y,z;
pcl::PointCloud<pcl::PointXYZ> pointCloud;
while (file >> x >> y >> z){
pcl::PointXYZ point;
point.x = x;
point.y = y;
point.z = z;
pointCloud.points.push_back(point);
//cout << "X: " << x;
//cout << "Y: " << y;
//cout << "Z: " << z;
}
cout << "they are " << pointCloud.points.size() << " points\n";
pointCloud.width = (uint32_t) pointCloud.points.size();
pointCloud.height = 1;
//float angularResolution = (float) ( 1.0f * (M_PI/180.0f)); // 1.0 degree in radians
float angularResolution_x = (float) ( 0.16f * (M_PI/180.0f)); // 1.0 degree in radians
float angularResolution_y = (float) ( 1.33f * (M_PI/180.0f)); // 1.0 degree in radians
float maxAngleWidth = (float) (360.0f * (M_PI/180.0f)); // 360.0 degree in radians
float maxAngleHeight = (float) (180.0f * (M_PI/180.0f)); // 180.0 degree in radians
Eigen::Affine3f sensorPose = (Eigen::Affine3f)Eigen::Translation3f(0.0f, 0.0f, 0.0f);
pcl::RangeImage::CoordinateFrame coordinate_frame = pcl::RangeImage::LASER_FRAME;
float noiseLevel=0.00;
float minRange = 0.0f;
int borderSize = 1;
//pcl::RangeImage rangeImage;
pcl::RangeImageSpherical rangeImage;
rangeImage.createFromPointCloud(pointCloud, angularResolution_x, angularResolution_y, maxAngleWidth, maxAngleHeight, sensorPose, coordinate_frame, noiseLevel, minRange, borderSize);
cout << rangeImage << "\n";
//visualize point cloud
boost::shared_ptr<pcl::RangeImage> range_image_ptr(&rangeImage);
pcl::PointCloud<PointType>::Ptr point_cloud_ptr (&pointCloud);
pcl::visualization::PCLVisualizer viewer ("3D viewer");
viewer.setBackgroundColor(1,1,1);
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointWithRange> range_image_color_handler (range_image_ptr, 0, 0, 0);
viewer.addPointCloud(range_image_ptr, range_image_color_handler, "range image");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "range image");
//viewer.addCoordinateSystem(1.0f);
//pcl::visualization::PointCloudColorHandlerCustom<PointType> point_cloud_color_handler (point_cloud_ptr, 150, 150, 150);
//viewer.addPointCloud (point_cloud_ptr, point_cloud_color_handler, "original point cloud");
viewer.initCameraParameters();
setViewerPose(viewer, rangeImage.getTransformationToWorldSystem());
pcl::visualization::RangeImageVisualizer widget("please work");
widget.showRangeImage(rangeImage);
widget.setSize(500, 500);
while (!viewer.wasStopped()){
widget.spinOnce();
viewer.spinOnce();
pcl_sleep(.01);
}
你能提供CSV文件吗? –