Skip to content

possible bug or documentation issue with picked indices for non-dense clouds in PCLVisualizer #266

@martyvona

Description

@martyvona

What seemed to be happening in our case is that we were adding a point cloud
to the visualizer that contained some NaN points, i.e. I think in the PCL
terminology it was not a "dense" point cloud.

The visualizer seems to remove such invalid points internally. The indices
that are reported for picks (I think this applies to both single point and
area picks) refer to the point cloud after this mutation.

We are working around the issue with code like this (this is a
generalization of our actual code that I did not test):

vector &indices; //picked indices from visualizer

sort(indices.begin(), indices.end());

const int m = indices.size(), n = cloud.points.size();

//i is index in original cloud
//j is index in virtual sparse cloud
//k is index in indices
for (int i = 0, j = 0, k = 0; (i < n) && (k < m); i++) {
if (isFinite(cloud.points[i])) {
while ((k < m) && (indices[k] == j)) indices[k++] = i;
j++;
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions