【发布时间】:2016-03-08 00:56:05
【问题描述】:
我为 velodyne-32E 激光雷达下载了一个示例 pcap,并将其中的 1 个帧保存为 csv 文件。使用 PCL,我想将点云可视化为范围图像,并与其交互以进行进一步处理(相机激光雷达校准)。到目前为止,我按照教程将垂直/水平角分辨率分别设置为 0.16 度和 1.33 度。点云看起来不错,但是生成的图像太小了,我真的认为我什么都看不到。
由于我使用的是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文件?
标签: point-cloud-library point-clouds