2015-12-03 52 views
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); 
} 

enter image description here

+0

你能提供CSV文件吗? –

回答

0

对我来说,它看起来像你的形象就好了。如果将分辨率设置为.16和1.33度,则可以得到一个图像,该图像等于环中激光的数量:360/0.16 = 2250px,垂直条纹的激光数量大约为40/1.33 = 30px。

这是因为velodyne 32的视图是360 x 40度,如数据表中所述。没有办法让图像看起来不同,除非你想让你的像素不是方形的。