pcl icon indicating copy to clipboard operation
pcl copied to clipboard

LabeledEuclideanClusterExtraction memory allocation

Open paulhilbert opened this issue 9 years ago • 1 comments

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

  1. Work with minimum necessary preallocalizations.
  2. Don't segfault without external preallocalizations.

Current Behavior

  1. Infeasible memory / address space requirements.
  2. 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);

paulhilbert avatar Mar 28 '17 12:03 paulhilbert

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

stale[bot] avatar May 19 '20 18:05 stale[bot]