Export: added random sample filter, added proportional radius filter, refactored when normals are computed (now after the clouds are assembled and voxelized), moved ceiling and floor filtering inside assembling loop.

This commit is contained in:
matlabbe
2022-01-14 13:36:01 -05:00
parent 12c2dd707c
commit 9e0173f4cb
8 changed files with 796 additions and 263 deletions

View File

@@ -160,9 +160,21 @@ inline pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr uniformSampling(
pcl::PointCloud<pcl::PointXYZ>::Ptr RTABMAP_EXP randomSampling(
const pcl::PointCloud<pcl::PointXYZ>::Ptr & cloud,
int samples);
pcl::PointCloud<pcl::PointNormal>::Ptr RTABMAP_EXP randomSampling(
const pcl::PointCloud<pcl::PointNormal>::Ptr & cloud,
int samples);
pcl::PointCloud<pcl::PointXYZRGB>::Ptr RTABMAP_EXP randomSampling(
const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud,
int samples);
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr RTABMAP_EXP randomSampling(
const pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr & cloud,
int samples);
pcl::PointCloud<pcl::PointXYZI>::Ptr RTABMAP_EXP randomSampling(
const pcl::PointCloud<pcl::PointXYZI>::Ptr & cloud,
int samples);
pcl::PointCloud<pcl::PointXYZINormal>::Ptr RTABMAP_EXP randomSampling(
const pcl::PointCloud<pcl::PointXYZINormal>::Ptr & cloud,
int samples);
pcl::IndicesPtr RTABMAP_EXP passThrough(
@@ -449,6 +461,99 @@ pcl::IndicesPtr RTABMAP_EXP radiusFiltering(
float radiusSearch,
int minNeighborsInRadius);
/* for convenience */
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointXYZ>::Ptr & cloud,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointNormal>::Ptr & cloud,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr & cloud,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointXYZI>::Ptr & cloud,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointXYZINormal>::Ptr & cloud,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
/**
* @brief Filter points based on distance from their viewpoint.
*
* @param cloud the input cloud.
* @param indices the input indices of the cloud to check, if empty, all points in the cloud are checked.
* @param viewpointIndices should be same size than the input cloud, it tells the viewpoint index in viewpoints for each point.
* @param viewpoints the viewpoints.
* @param factor will determine the search radius based on the distance from a point and its viewpoint. Setting it higher will filter points farther from accurate points (but processing time will be also higher).
* @param neighborScale will scale the search radius of neighbors found around a point. Setting it higher will accept more noisy points close to accurate points (but processing time will be also higher).
* @return the indices of the points satisfying the parameters.
*/
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointXYZ>::Ptr & cloud,
const pcl::IndicesPtr & indices,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointNormal>::Ptr & cloud,
const pcl::IndicesPtr & indices,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud,
const pcl::IndicesPtr & indices,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr & cloud,
const pcl::IndicesPtr & indices,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointXYZI>::Ptr & cloud,
const pcl::IndicesPtr & indices,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
pcl::IndicesPtr RTABMAP_EXP proportionalRadiusFiltering(
const pcl::PointCloud<pcl::PointXYZINormal>::Ptr & cloud,
const pcl::IndicesPtr & indices,
const std::vector<int> & viewpointIndices,
const std::map<int, Transform> & viewpoints,
float factor,
float neighborScale=1.0f);
/**
* For convenience.
*/

View File

@@ -487,6 +487,11 @@ void RTABMAP_EXP adjustNormalsToViewPoints(
const pcl::PointCloud<pcl::PointXYZ>::Ptr & rawCloud,
const std::vector<int> & rawCameraIndices,
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr & cloud);
void RTABMAP_EXP adjustNormalsToViewPoints(
const std::map<int, Transform> & poses,
const pcl::PointCloud<pcl::PointXYZ>::Ptr & rawCloud,
const std::vector<int> & rawCameraIndices,
pcl::PointCloud<pcl::PointXYZINormal>::Ptr & cloud);
void RTABMAP_EXP adjustNormalsToViewPoints(
const std::map<int, Transform> & viewpoints,