UnaNancyOwen / VelodyneCapture

VelodyneCapture is the general capture class to retrieve the laser data from Velodyne sensors using Boost.Asio and PCAP
MIT License
54 stars 21 forks source link

How to implement PCL Filters on Lidar data? #10

Closed kavinat closed 7 years ago

kavinat commented 7 years ago

Hi, I managed to capture the data successfully through this algorithm. Now I want to implement PCL Filters (Morphological filter for ground recognition etc) on the data I have captured. How can I achieve that? I tried initializing a localized pointer in my algorithm, copy the data (x,y,z) into it and make it work but to no use. I am not able to get the visualizer window itself.

`
boost::shared_ptr<pcl::PointCloud> FLasers ( new pcl::PointCloud); capture >> lasers; if (lasers.empty()) { continue; }

    *FLasers = lasers;

    //  filtering object
    pcl::ProgressiveMorphologicalFilter<pcl::PointXYZ> pmf;
    pmf.setInputCloud(FLasers);
    pmf.setMaxWindowSize(20);
    pmf.setSlope(0.1f);
    pmf.setInitialDistance(0.5f);
    pmf.setMaxDistance(3.0f);
    pmf.extract(ground->indices);

    // Extraction of filtering object
    pcl::ExtractIndices<pcl::PointXYZ> extract;
    extract.setInputCloud(FLasers);
    extract.setIndices(ground);
    extract.filter(*cloud_filtered);

    for (int j = 0; j <cloud_filtered->points.size(); j++)
    {

     buffer.push_back(cv::Vec3f(cloud_filtered->points[j].x,cloud_filtered->points[j].y,cloud_filtered->points[j].z));

    }
    FLasers->clear();
    lasers.clear();
    cloud_filtered->clear();
    `
UnaNancyOwen commented 7 years ago

The VelodyneCapture class is unrelated with PCL. If you have question about PCL, Please post to PCL users forum. If you want to use PCL with Velodyne sensors, I think that it is better to use I/O features (pcl::HDLGrabber or pcl::VLPGrabber) of PCL.