PointCloudLibrary / PointCloudLibrary/pcl
LabeledEuclideanClusterExtraction memory allocation
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 4.7k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 6
Description
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);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at segmentation/include/pcl/segmentation/impl/extract_labeled_clusters.hpp around the linked access and reproduce the issue with the provided extraction example. Trace how labels determine the output vector allocation and verify behavior with a label of std::numeric_limits<uint32_t>::max(). Done means extraction avoids infeasible allocation and does not segfault without external preallocation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100