PointCloudLibrary / PointCloudLibrary/pcl

LabeledEuclideanClusterExtraction memory allocation

Open
#1,849 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: stale
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

  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);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.