首页 文章

PCL(点 Cloud 库)范围图像太小

提问于
浏览
0

我为velodyne-32E lIDAR下载了一个示例pcap,并将其中一个帧保存为csv文件 . 使用PCL,我想将点 Cloud 可视化为范围图像,并与其进行交互以进行进一步处理(相机 - 激光雷达校准) . 到目前为止,我按照教程并将垂直/水平角分辨率分别设置为.16和1.33度 . 点 Cloud 似乎很好,但生成的图像非常小,我真的不认为我能看到任何东西 .

由于我使用 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);
}

enter image description here

1 回答

  • 0

    对我而言,你的形象看起来很好 . 如果将分辨率设置为.16和1.33度,则得到的图像等于环中激光的数量:360 / 0.16 = 2250px,垂直条纹中的激光数量,约为40 / 1.33 = 30px .

    这是因为velodyne 32的视图是360×40度,如数据表中所述 . 实际上没有办法让图像看起来不同,除非你希望你的像素是非正方形的 .

相关问题