Skip to content

beam_filtering

Nick Charron edited this page Jun 13, 2019 · 4 revisions

beam_filtering

This module contains objects for filtering point clouds. Point clouds can be single scans, or full point cloud maps.

Classes

CropBox

This class has functionality similar to the PCL cropbox filter that can be found here: http://docs.pointclouds.org/trunk/classpcl_1_1_crop_box.html

This filter removes points inside or outside of a preset cube. The cube dimensions are set by the user using min and max x, y, and z parameters.

The filter was implemented instead of using PCL's filter since we were having issues with that filter. Different people were getting different results with the same exact code (maybe versioning was messing things up). Also the interface isn't very easy to understand/use.

Example usage:

#include "beam_filtering/CropBox.h"
#include "beam_utils/math.hpp"
PointCloud::Ptr input_cloud = boost::make_shared<PointCloud>();
PointCloud::Ptr output_cloud = boost::make_shared<PointCloud>();

Eigen::Vector3f min_vec(-1, -1, -1);
Eigen::Vector3f max_vec(1, 1, 1);
Eigen::Affine3f transform_box;
transform_box.matrix().setIdentity();

beam_filtering::CropBox cropper;
cropper.SetMinVector(min_vec);
cropper.SetMaxVector(max_vec);
cropper.SetTransform(transform_box);
cropper.SetRemoveOutsidePoints(true); // this is default, not needed
cropper.Filter(*input_cloud, *output_cloud);

DROR

This class implements the dynamic radius outlier filter that was first published in Steve and Nick's CRV paper which can be found here: https://ieeexplore.ieee.org/abstract/document/8575761

This filter is very similar to PCL's radius outlier removal filter, but changes the search radius for each point depending on sensor properties and distance from sensor. This filter can only be implemented on single scans where density decreases with increased distance from sensor origin

As of now, this filter only works on only pcl::PointCloud<pcl::PointXYZI> point cloud types but can be easily extended to other types if needed.

Example usage:

#include "beam_filtering/DROR.h"
#include "beam_utils/math.hpp"
#include <pcl/io/pcd_io.h>
PointCloud::Ptr input_cloud = boost::make_shared<PointCloud>();
PointCloud::Ptr output_cloud = boost::make_shared<PointCloud>();
std::string pcd_location = "scan.pcd";

if (pcl::io::loadPCDFile<pcl::PointXYZ>(pcd_location, *input_cloud) == -1) {
  LOG_INFO("Couldn't read pcd file:  %s\n", pcd_location.c_str());
} else {
  LOG_INFO("Opened file: %s", pcd_location.c_str());
}
beam_filtering::DROR outlier_removal;
double min_neighbors = 3, radius_multiplier = 3, azimuth_angle = 0.16,
       min_search_radius = 0.04;
outlier_removal.SetRadiusMultiplier(radius_multiplier);
outlier_removal.SetAzimuthAngle(azimuth_angle);
outlier_removal.SetMinNeighbors(min_neighbors);
outlier_removal.SetMinSearchRadius(min_search_radius);
outlier_removal.Filter(*input_cloud, *output_cloud);

Clone this wiki locally