davidcaron / pclpy

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

pcl.segmentation.SupervoxelClustering.PointXYZRGBA#extract() dumps core #86

Open nishi-takao opened 3 years ago

nishi-takao commented 3 years ago

I met core dump on Ubunt 18.04/Python 3.6.9 with following code;

from pclpy import pcl

cloud=pcl.PointCloud.PointXYZRGBA()
pcl.io.loadPCDFile('foo.pcd',cloud)

Voxel_resolution=0.008
Seed_resolution=0.1
Color_importance=0.2
Spatial_importance=0.4
Normal_importance=1.0

svc=pcl.segmentation.SupervoxelClustering.PointXYZRGBA(
    Voxel_resolution,
    Seed_resolution
)
svc.setInputCloud(cloud)
svc.setColorImportance(Color_importance)
svc.setSpatialImportance(Spatial_importance)
svc.setNormalImportance(Normal_importance)

clusters=pcl.vectors.map_uint32t_PointXYZRGBA()
svc.extract(clusters) # => dumps core

python, pclpy and related libraries were installed via anaconda.

Regards

nishi-takao commented 3 years ago

The original C++ code ( https://pointclouds.org/documentation/tutorials/supervoxel_clustering.html ) says

typedef pcl::PointXYZRGBA PointT;
// (snip)
std::map <std::uint32_t, pcl::Supervoxel<PointT>::Ptr > supervoxel_clusters;
super.extract (supervoxel_clusters);

That is, I think the argument of extract() is not an instance of pcl.vectors.map_uint32t_PointXYZRGBA, but something like pcl.vectors.map_uint32t_SupervoxelXYZRGBA (And these don't seem to be defined).

nishi-takao commented 3 years ago

SuperVoxel class includes two containers, one for PointT and one for Normal, and some its onw methods. ( https://pointclouds.org/documentation/supervoxel__clustering_8h_source.html ). So I think we should define some new python classes for Supervoxel.