pcl
pcl copied to clipboard
LabeledEuclideanClusterExtraction memory allocation
The LabeledEuclideanClusterExtraction demands a preallocalization of the output vector (vector of vector of point indices) in the number of labels (see this access ).
Although infeasible (or at least impracticable) for small labels, at least in the case of the label std::numeric_limits<uint32_t>::max() (which is a valid label) it becomes quite apparent that this won't work.
Your Environment
- Operating System and version: Arch Linux
- Compiler: clang 5.0
- PCL Version: 1.8.0
Expected Behavior
- Work with minimum necessary preallocalizations.
- Don't segfault without external preallocalizations.
Current Behavior
- Infeasible memory / address space requirements.
- Segfaults.
Possible Solution
The expected outcome is a mapping of labels to segments. There is a reason std::map exists...
Code to Reproduce
extraction_t extr;
extr.setClusterTolerance(irrelevant);
extr.setMinClusterSize(1);
extr.setInputCloud(cloud);
std::vector<std::vector<pcl::PointIndices>> result;
extr.extract(result);
Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.