Voxel Grid Filter disorganises points

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Voxel Grid Filter disorganises points

skeps001
This post was updated on .
I am trying to filter a medium sized point cloud (91 million points) that is globally referenced, with bounds of roughly 200m x 100m x 50m. Following the tutorial on the Voxel Grid down-sampling on the PCL website, I managed to get the down-sampling working correctly. The original laser scan data comes from a .LAS file, but for some reason liblas won't work through C++ (already done other work in Python with liblas).

Code for the down-sampling:
-------------------------------------------------------------------------------------------------------
  // Initialise the reader and open the .pcd file
  pcl::PCDReader reader;
  std::cout << "Attempting to open the .pcd file... " << std::endl;
  reader.read ("inputfile.pcd", *cloud);
  // TODO: Put in check to determine whether or not the file opened
  std::cout << "...file opened successfully!" << std::endl;

  std::cerr << "PointCloud before filtering: " << cloud->width * cloud->height
       << " data points (" << pcl::getFieldsList (*cloud) << ")." << std::endl;

  // Perform the actual filtering
  pcl::VoxelGrid<sensor_msgs::PointCloud2> sor;
  sor.setInputCloud (cloud);
  sor.setLeafSize (0.01f, 0.01f, 0.01f);
  sor.filter (*cloud_filtered);

  std::cerr << "PointCloud after filtering: " << cloud_filtered->width * cloud_filtered->height
       << " data points (" << pcl::getFieldsList (*cloud_filtered) << ")." << std::endl;

  pcl::PCDWriter writer;
  writer.write ("outputfile.pcd", *cloud_filtered,
         Eigen::Vector4f::Zero (), Eigen::Quaternionf::Identity (), false);
-------------------------------------------------------------------------------------------------------


Original .pcd file (snippet):
-------------------------------------------------------------------------------------------------------
       1 VERSION .7
       2 FIELDS x y z time
       3 SIZE 4 4 4 4
       4 TYPE F F F F
       5 COUNT 1 1 1 1
       6 WIDTH 91112040
       7 HEIGHT 1
       8 VIEWPOINT 0 0 0 1 0 0 0
       9 POINTS 91112040
      10 DATA ascii
      11 -0.2802 0.0476 0.4011 1337745329.85016537
      12 -0.2823 0.0485 0.3990 1337745329.85018277
      13 -0.2845 0.0494 0.3969 1337745329.85020018
      14 -0.2866 0.0503 0.3948 1337745329.85021734
      15 -0.2887 0.0512 0.3927 1337745329.85023475
      16 -0.2959 0.0542 0.3965 1337745329.85025215
      17 -0.2980 0.0551 0.3943 1337745329.85026956
      18 -0.3001 0.0560 0.3922 1337745329.85028696
      19 -0.3003 0.0561 0.3878 1337745329.85030437
      20 -0.2941 0.0536 0.3763 1337745329.85032153
-------------------------------------------------------------------------------------------------------


Down-sampled .pcd file (snippet):
-------------------------------------------------------------------------------------------------------
       1 # .PCD v0.7 - Point Cloud Data file format
       2 VERSION 0.7
       3 FIELDS x y z time
       4 SIZE 4 4 4 4
       5 TYPE F F F F
       6 COUNT 1 1 1 1
       7 WIDTH 54092242
       8 HEIGHT 1
       9 VIEWPOINT 0 0 0 1 0 0 0
      10 POINTS 54092242
      11 DATA ascii
      12 7.4951 -51.798 1.9924999 1.3377472e+09
      13 7.5222998 -51.792301 1.9956 1.3377472e+09
      14 0.067500003 -66.4655 0.77340001 1.3377471e+09
      15 69.709602 -56.7453 -3.2749 1.3377457e+09
      16 69.713097 -56.740799 -3.2797999 1.3377457e+09
      17 -4.9101 -81.135399 -0.44499999 1.3377471e+09
      18 -4.9081998 -81.130402 -0.44980001 1.3377471e+09
      19 -62.777802 -219.1373 0.22660001 1.3377466e+09
      20 10.8869 -247.28819 -4.5402002 1.3377463e+09
-------------------------------------------------------------------------------------------------------

Due to a dynamic environment, it is required that the .pcd file stays organised to follow the trajectory of the scanner.
Is it possible to perform this type of down-sampling while keeping the output points ordered by - ideally - time?
Reply | Threaded
Open this post in threaded view
|

Re: Voxel Grid Filter disorganises points

Radu B. Rusu
Administrator
Phil,

Looking at the original data that you posted:
 >         6 WIDTH 91112040
 >         7 HEIGHT 1
 >         8 VIEWPOINT 0 0 0 1 0 0 0
 >         9 POINTS 91112040

This indicates that it's not organized from a PCL perspective. What sort of an organization were you referring to?

Cheers,
Radu.
--
http://openperception.org

On 01/21/2013 09:35 PM, phil.skelton wrote:

> I am trying to filter a medium sized point cloud (91 million points) that is
> globally referenced, with bounds of roughly 200m x 100m x 50m. Following the
> tutorial on the Voxel Grid down-sampling on the PCL website, I managed to
> get the down-sampling working correctly. The original laser scan data comes
> from a .LAS file, but for some reason liblas won't work through C++ (already
> done other work in Python with liblas).
>
> Code for the down-sampling:
> -------------------------------------------------------------------------------------------------------
>    // Initialise the reader and open the .pcd file
>    pcl::PCDReader reader;
>    std::cout << "Attempting to open the .pcd file... " << std::endl;
>    reader.read ("/scratch/lasfiles/102_wblock/102_wblock_3dlm.pcd", *cloud);
>    // TODO: Put in check to determine whether or not the file opened
>    std::cout << "...file opened successfully!" << std::endl;
>
>    std::cerr << "PointCloud before filtering: " << cloud->width *
> cloud->height
>         << " data points (" << pcl::getFieldsList (*cloud) << ")." <<
> std::endl;
>
>    // Perform the actual filtering
>    pcl::VoxelGrid<sensor_msgs::PointCloud2> sor;
>    sor.setInputCloud (cloud);
>    sor.setLeafSize (0.01f, 0.01f, 0.01f);
>    sor.filter (*cloud_filtered);
>
>    std::cerr << "PointCloud after filtering: " << cloud_filtered->width *
> cloud_filtered->height
>         << " data points (" << pcl::getFieldsList (*cloud_filtered) << ")."
> << std::endl;
>
>    pcl::PCDWriter writer;
>    writer.write ("/scratch/lasfiles/102_wblock/filtered_102_wblock_3dlm.pcd",
> *cloud_filtered,
>           Eigen::Vector4f::Zero (), Eigen::Quaternionf::Identity (), false);
> -------------------------------------------------------------------------------------------------------
>
>
> Original .pcd file (snippet):
> -------------------------------------------------------------------------------------------------------
>         1 VERSION .7
>         2 FIELDS x y z time
>         3 SIZE 4 4 4 4
>         4 TYPE F F F F
>         5 COUNT 1 1 1 1
>         6 WIDTH 91112040
>         7 HEIGHT 1
>         8 VIEWPOINT 0 0 0 1 0 0 0
>         9 POINTS 91112040
>        10 DATA ascii
>        11 -0.2802 0.0476 0.4011 1337745329.85016537
>        12 -0.2823 0.0485 0.3990 1337745329.85018277
>        13 -0.2845 0.0494 0.3969 1337745329.85020018
>        14 -0.2866 0.0503 0.3948 1337745329.85021734
>        15 -0.2887 0.0512 0.3927 1337745329.85023475
>        16 -0.2959 0.0542 0.3965 1337745329.85025215
>        17 -0.2980 0.0551 0.3943 1337745329.85026956
>        18 -0.3001 0.0560 0.3922 1337745329.85028696
>        19 -0.3003 0.0561 0.3878 1337745329.85030437
>        20 -0.2941 0.0536 0.3763 1337745329.85032153
> -------------------------------------------------------------------------------------------------------
>
>
> Down-sampled .pcd file (snippet):
> -------------------------------------------------------------------------------------------------------
>         1 # .PCD v0.7 - Point Cloud Data file format
>         2 VERSION 0.7
>         3 FIELDS x y z time
>         4 SIZE 4 4 4 4
>         5 TYPE F F F F
>         6 COUNT 1 1 1 1
>         7 WIDTH 54092242
>         8 HEIGHT 1
>         9 VIEWPOINT 0 0 0 1 0 0 0
>        10 POINTS 54092242
>        11 DATA ascii
>        12 7.4951 -51.798 1.9924999 1.3377472e+09
>        13 7.5222998 -51.792301 1.9956 1.3377472e+09
>        14 0.067500003 -66.4655 0.77340001 1.3377471e+09
>        15 69.709602 -56.7453 -3.2749 1.3377457e+09
>        16 69.713097 -56.740799 -3.2797999 1.3377457e+09
>        17 -4.9101 -81.135399 -0.44499999 1.3377471e+09
>        18 -4.9081998 -81.130402 -0.44980001 1.3377471e+09
>        19 -62.777802 -219.1373 0.22660001 1.3377466e+09
>        20 10.8869 -247.28819 -4.5402002 1.3377463e+09
> -------------------------------------------------------------------------------------------------------
>
> Due to a dynamic environment, it is required that the .pcd file stays
> organised to follow the trajectory of the scanner.
> Is it possible to perform this type of down-sampling while keeping the
> output points ordered by - ideally - time?
>
>
>
> --
> View this message in context: http://www.pcl-users.org/Voxel-Grid-Filter-disorganises-points-tp4025592.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
>
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Voxel Grid Filter disorganises points

skeps001
This post was updated on .
Hi Radu,

Thanks for the fast reply. My apologies for the confusion on what I was classing as 'organised'.

The scanner is a pan-tilt 2D laser on a moving platform, and stop-start scanning isn't an option so the scanner quite often looks over the same space multiple times. This causes a lot of overhead when trying to produce a 'real-time' octree (currently using OctoMap, but open to using PCL libraries) with ray casting. Additionally, this data has been through our own scan-matching algorithms, which aren't capable of being adapted to perform this sort of filtering.

While we aren't looking at generating octree maps in real-time from the data, having the ability to play back a .bag file in ROS at real-time speeds allows the development of the software to cope with real-time data, if the need arises.

So, what I would like to be able to do is to load the entire data set in, perform a weighted down-sampling (i.e. the PCL Voxel-Grid approach), and save the data set back out with the resulting points ordered by time.

I guess the question is: how does the PCL Voxel-Grid algorithm handle the timestamps of the points that are being weighed together inside the voxel?
Reply | Threaded
Open this post in threaded view
|

Re: Voxel Grid Filter disorganises points

Radu B. Rusu
Administrator
Phil,

It looks like you need something a bit more custom when it comes to "octrees". Julius will most likely provide a better
answer than I can, but from my perspective, you should consider keeping the original data as much as possible, in case
you decide to change the parameters of your octree/voxel grid later.

We are about to start two large projects on realtime point cloud compression for massive datasets in collaboration with
Leica (http://www.pointclouds.org/news/2013/01/08/leica-geosystems-partnership/). Perhaps the results of these efforts
will be useful for your application as well.

Cheers,
Radu.
--
http://openperception.org

On 01/21/2013 10:46 PM, skeps001 wrote:

> Hi Radu,
>
> Thanks for the fast reply. My apologies for the confusion on what I was
> classing as 'organised'.
>
> The scanner is a pan-tilt 2D laser on a moving platform, and stop-start
> scanning isn't an option so the scanner quite often looks over the same
> space multiple times. This causes a lot of overhead when trying to produce a
> 'real-time' octree (currently using OctoMap, but open to using PCL
> libraries) with ray casting.
>
> While we aren't looking at generating octree maps in real-time from the
> data, having the ability to play back a .bag file in ROS at real-time speeds
> allows the development of the software to cope with real-time data, if the
> need arises.
>
> So, what I would like to be able to do is to load the entire data set in,
> perform a weighted down-sampling (i.e. the PCL Voxel-Grid approach), and
> save the data set back out with the resulting points ordered by time.
>
> I guess the question is: how does the PCL Voxel-Grid algorithm handle the
> timestamps of the points that are being weighed together inside the voxel?
>
>
>
> --
> View this message in context: http://www.pcl-users.org/Voxel-Grid-Filter-disorganises-points-tp4025592p4025597.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
>
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: Voxel Grid Filter disorganises points

Julius Kammerl-2
Hi Phil,

an octree as well as the voxel grid filter (based on a memory map)
cluster the points in accordance to their spatial position. Hence
timestamps and other point related information are not considered during
the downsampling process.

You could modify the octree in order to query only points with certain
timestamps. If you cannot query for specific time instances since your
data is continuously recorded, you might need to sort the downsampled
point set.

Cheers,
Julius

On 01/21/2013 11:04 PM, Radu B. Rusu wrote:

> Phil,
>
> It looks like you need something a bit more custom when it comes to
> "octrees". Julius will most likely provide a better answer than I can,
> but from my perspective, you should consider keeping the original data
> as much as possible, in case you decide to change the parameters of your
> octree/voxel grid later.
>
> We are about to start two large projects on realtime point cloud
> compression for massive datasets in collaboration with Leica
> (http://www.pointclouds.org/news/2013/01/08/leica-geosystems-partnership/).
> Perhaps the results of these efforts will be useful for your application
> as well.
>
> Cheers,
> Radu.
> --
> http://openperception.org
>
> On 01/21/2013 10:46 PM, skeps001 wrote:
>> Hi Radu,
>>
>> Thanks for the fast reply. My apologies for the confusion on what I was
>> classing as 'organised'.
>>
>> The scanner is a pan-tilt 2D laser on a moving platform, and stop-start
>> scanning isn't an option so the scanner quite often looks over the same
>> space multiple times. This causes a lot of overhead when trying to
>> produce a
>> 'real-time' octree (currently using OctoMap, but open to using PCL
>> libraries) with ray casting.
>>
>> While we aren't looking at generating octree maps in real-time from the
>> data, having the ability to play back a .bag file in ROS at real-time
>> speeds
>> allows the development of the software to cope with real-time data, if
>> the
>> need arises.
>>
>> So, what I would like to be able to do is to load the entire data set in,
>> perform a weighted down-sampling (i.e. the PCL Voxel-Grid approach), and
>> save the data set back out with the resulting points ordered by time.
>>
>> I guess the question is: how does the PCL Voxel-Grid algorithm handle the
>> timestamps of the points that are being weighed together inside the
>> voxel?
>>
>>
>>
>> --
>> View this message in context:
>> http://www.pcl-users.org/Voxel-Grid-Filter-disorganises-points-tp4025592p4025597.html
>>
>> Sent from the Point Cloud Library (PCL) Users mailing list mailing
>> list archive at Nabble.com.
>> _______________________________________________
>> [hidden email] / http://pointclouds.org
>> http://pointclouds.org/mailman/listinfo/pcl-users
>>
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

signature.asc (917 bytes) Download Attachment