0
votes

I downloaded a sample pcap for the velodyne-32E lIDAR and saved 1 of the frames as a csv file. Using PCL, I want to visualise the point cloud as a range image as well as interacting with it for further processing purposes (camera-lidar calibration). So far, I followed the tutorials and set the vertical/horizontal angular resolution to .16 and 1.33 degrees respectively. The point cloud seemed fine, but the generated image is so small that I don't really think I can see anything.

Since I'm using RangeImageVisualiser and not PCLVisualiser, I don't really seem to be given any controls here. Any idea how I can make my image more viewable?

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
Can you provide the CSV file? - Victor Lamoine

1 Answers

0
votes

To me it looks like your image is just fine. If you set the resolutions to .16 and 1.33 degrees, you get an image that is equal to the number of lasers in a ring: 360 / 0.16 = 2250px by the number of lasers in a vertical stripe, approximately 40 / 1.33 = 30px.

That is because the view of the velodyne 32 is 360 x 40 degrees as is stated in the data sheet. There is really no way to having that image to look differently, unless, you want your pixel to be non-square.