Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

mvieth
Copy link
Member

@mvieth mvieth commented Sep 23, 2025

The bug was introduced in 053995b It occurs when indices are given to RegionGrowing(RGB) that are not a complete set of indices. For example, in the RegionGrowing tutorial, if milk_cartoon_all_small_clorox.pcd is used instead of region_growing_tutorial.pcd (the first file contains NaNs but the second one does not). If PCL was compiled in debug mode, an assertion triggers here:

assert (index >= 0 && index < static_cast<index_t> (indices_->size ()) && "Out-of-bounds error in nearestKSearch!");
Otherwise, the segmentation results are just very bad. Fixes #6348

The bug was introduced in PointCloudLibrary@053995b
It occurs when indices are given to RegionGrowing(RGB) that are not a complete set of indices. For example, in the [RegionGrowing tutorial](https://pcl.readthedocs.io/projects/tutorials/en/master/region_growing_segmentation.html), if milk_cartoon_all_small_clorox.pcd is used instead of region_growing_tutorial.pcd (the first file contains NaNs but the second one does not).
If PCL was compiled in debug mode, an assertion triggers here:
https://github.com/PointCloudLibrary/pcl/blob/f5fd21531b6cb19724227490949e66b5ce171075/search/include/pcl/search/impl/search.hpp#L106
Otherwise, the segmentation results are just very bad.
Fixes PointCloudLibrary#6348
@mvieth mvieth added module: segmentation changelog: fix Meta-information for changelog generation labels Sep 23, 2025
@larshg
Copy link
Contributor

larshg commented Sep 24, 2025

Should we add a test with nans removed and indices used? for both with and without color?

@mvieth
Copy link
Member Author

mvieth commented Sep 24, 2025

Should we add a test with nans removed and indices used? for both with and without color?

You are right, tests are a good idea. I re-used one of the point clouds that are already passed to the test, and created a partial set of indices. Both new tests fail without the fix in this PR.

@mvieth mvieth merged commit 3c65601 into PointCloudLibrary:master Sep 24, 2025
13 checks passed
@mvieth mvieth deleted the region_growing_bug branch September 24, 2025 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Meta-information for changelog generation module: segmentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

region-growing-segmentation example occurr Out-of-bounds error in nearestKSearch
2 participants