davidcaron / pclpy

Python bindings for the Point Cloud Library (PCL)
MIT License
428 stars 59 forks source link

C++ version to python version,std::multimap<uint32_t, uint32_t> #39

Open millionsofluo opened 5 years ago

millionsofluo commented 5 years ago

Hi,

how to get std::multimap<uint32_t, uint32_t> supervoxel_adjacency data type input supervox.getSupervoxelAdjacency()

C++ code: std::multimap<uint32_t, uint32_t> supervoxel_adjacency; super.getSupervoxelAdjacency(supervoxel_adjacency);

question: TypeError: getSupervoxelAdjacency(): incompatible function arguments. The following argument types are supported:

  1. (self: pclpy.pcl.segmentation.SupervoxelClustering.PointXYZRGBA, label_adjacency: std::multimap<unsigned int,unsigned int,std::less,std::allocator<std::pair<unsigned int const ,unsigned int> > >) -> None

c++

      float voxel_resolution = 0.008f;
      float seed_resolution = 0.1f;
      float color_importance = 0.2f;
      float spatial_importance = 0.4f;
      float normal_importance = 1.0f;
      pcl::SupervoxelClustering<PointT> super (voxel_resolution, seed_resolution);
      super.setInputCloud (cloud);
      super.setColorImportance (color_importance);
      super.setSpatialImportance (spatial_importance);
      super.setNormalImportance (normal_importance);
      std::map <uint32_t, pcl::Supervoxel<PointT>::Ptr > supervoxel_clusters;
      super.extract (supervoxel_clusters);
      std::multimap<uint32_t, uint32_t> supervoxel_adjacency;
      super.getSupervoxelAdjacency (supervoxel_adjacency);

my python code

    voxel_resolution = 1
    seed_resolution = 2
    color_importance = 2
    spatial_importance = 4
    normal_importance = 1.0
    supervox = pcl.segmentation.SupervoxelClustering.PointXYZRGBA(voxel_resolution, seed_resolution)
    supervox.setInputCloud(cloud)
    supervox.setColorImportance(color_importance)
    supervox.setSpatialImportance(spatial_importance)
    supervox.setNormalImportance(normal_importance)
    supervoxel_clusters = pcl.vectors.map_uint32t_PointXYZRGBA()
    supervox.extract(supervoxel_clusters)
    supervoxel_adjacency = ???
    supervox.getSupervoxelAdjacency(supervoxel_adjacency)

please help Thanks!

Famok commented 5 years ago

Hi,

Same problem here! This would be incredible useful.

davidcaron commented 5 years ago

The std::multimap<uint32_t, uint32_t> type would need to be explicitly added to pclpy/src/vector_classes.hpp it's not being compiled currently. And a quick search for multimap in pybind11's documentation doesn't return anything... so that could be an issue as well.

Famok commented 5 years ago

So there is no way to integrate this anytime soon?

millionsofluo commented 5 years ago

The std::multimap<uint32_t, uint32_t> type would need to be explicitly added to pclpy/src/vector_classes.hpp it's not being compiled currently. And a quick search for multimap in pybind11's documentation doesn't return anything... so that could be an issue as well.

Thank you. I'll try.