Skip to content

SupervoxelClustering: Improvement of Supervoxels point cloud data format processing #2949

@chaozige

Description

@chaozige

Your Environment

  • PCL Version:master branch

Context

/** \brief Static helper function which returns a pointcloud of normals for the input supervoxels
* \param[in] supervoxel_clusters Supervoxel cluster map coming from this class
* \returns Cloud of PointNormals of the supervoxels
*
*/
static pcl::PointCloud<pcl::PointNormal>::Ptr
makeSupervoxelNormalCloud (std::map<uint32_t,typename Supervoxel<PointT>::Ptr > &supervoxel_clusters);

Expected Behavior

Add or change a static helper function

  • \ brief static helper function, return point cloud of labeled normal input voxel
  • \ param [in] Supervoxel cluster map in supervoxel_clusters
  • \ Back to super-voxel PointXYZLNormals cloud

Current Behavior

PointLCloudT::Ptr refined_labeled_voxel_cloud = super.getLabeledVoxelCloud ();
PointNCloudT::Ptr refined_sv_normal_cloud = pcl::SupervoxelClustering<PointT>::makeSupervoxelNormalCloud (refined_supervoxel_clusters);
PointLCloudT::Ptr refined_full_labeled_cloud = super.getLabeledCloud ();

In order to facilitate the processing of the above three point cloud data, the association is generated by the following three point clouds with labels.

PointLCloudT::Ptr refined_labeled_voxel_cloud
PointLNCloudT::Ptr refined_sv_l_normal_cloud
PointLCloudT::Ptr refined_full_labeled_cloud

Possible Solution

A ideas how to implement the addition or change

/** \brief Static helper function which returns a pointcloud of normals for the input supervoxels
* \param[in] supervoxel_clusters Supervoxel cluster map coming from this class
* \returns Cloud of PointNormals of the supervoxels
*
*/
static pcl::PointCloud<pcl::PointNormal>::Ptr
makeSupervoxelNormalCloud (std::map<uint32_t,typename Supervoxel<PointT>::Ptr > &supervoxel_clusters);

Add the following function declaration at the end of the above

static pcl::PointCloudpcl::PointXYZLNormal::Ptr
makeSupervoxelXYZLNormalCloud(std::map<uint32_t, typename Supervoxel::Ptr> &supervoxel_clusters);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointT> pcl::PointCloud<pcl::PointNormal>::Ptr
pcl::SupervoxelClustering<PointT>::makeSupervoxelNormalCloud (std::map<uint32_t,typename Supervoxel<PointT>::Ptr > &supervoxel_clusters)
{
pcl::PointCloud<pcl::PointNormal>::Ptr normal_cloud (new pcl::PointCloud<pcl::PointNormal>);
normal_cloud->resize (supervoxel_clusters.size ());
pcl::PointCloud<pcl::PointNormal>::iterator normal_cloud_itr = normal_cloud->begin ();
for (auto sv_itr = supervoxel_clusters.cbegin (), sv_itr_end = supervoxel_clusters.cend ();
sv_itr != sv_itr_end; ++sv_itr, ++normal_cloud_itr)
{
(sv_itr->second)->getCentroidPointNormal (*normal_cloud_itr);
}
return normal_cloud;
}

Add the following function definition at the end of the above

template pcl::PointCloudpcl::PointXYZLNormal::Ptr
pcl::SupervoxelClustering::makeSupervoxelXYZLNormalCloud(std::map<uint32_t, typename Supervoxel::Ptr > &supervoxel_clusters)
{
***
}

// Types
typedef pcl::PointXYZRGBA PointT;
typedef pcl::PointCloud<PointT> PointCloudT;
typedef pcl::PointNormal PointNT;
typedef pcl::PointCloud<PointNT> PointNCloudT;
typedef pcl::PointXYZL PointLT;
typedef pcl::PointCloud<PointLT> PointLCloudT;
typedef pcl::Normal NormalT;
typedef pcl::PointCloud<NormalT> NormalCloudT;

Add the following types at the end of the above

typedef pcl::PointXYZLNormal PointLNT;
typedef pcl::PointCloud PointLNCloudT;

PointLCloudT::Ptr refined_labeled_voxel_cloud = super.getLabeledVoxelCloud ();
PointNCloudT::Ptr refined_sv_normal_cloud = pcl::SupervoxelClustering<PointT>::makeSupervoxelNormalCloud (refined_supervoxel_clusters);
PointLCloudT::Ptr refined_full_labeled_cloud = super.getLabeledCloud ();

Add the following to generate a labeled normal point cloud at the end of the above

PointLNCloudT::Ptr refined_sv_l_normal_cloud = pcl::SupervoxelClustering::makeSupervoxelXYZLNormalCloud(refined_supervoxel_clusters);

There may be some other additions or changes, such as the following

void
getCentroidPointNormal (PointNormal &normal_arg)
{
normal_arg.x = centroid_.x;
normal_arg.y = centroid_.y;
normal_arg.z = centroid_.z;
normal_arg.normal_x = normal_.normal_x;
normal_arg.normal_y = normal_.normal_y;
normal_arg.normal_z = normal_.normal_z;
normal_arg.curvature = normal_.curvature;
}

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions