Pcl: Wrong index in pcl::cropbox

Created on 13 Mar 2019  路  6Comments  路  Source: PointCloudLibrary/pcl

Operating System and version: Ubuntu 16.04
Compiler: GCC
PCL Version: 1.7

I have some strange behavior in the Cropbox filter. If I use the filter without setting the indices via Cropbox::setIndices(..), it works as expected. Once I set the indices, with only a subset of the whole pointcloud indices, the output is confusing. It seems that a lot of points are missing in the output.

I guess it has something to do with line 101 in the cropbox.hpp file. Shouldn't it be (* indices_) [index] instead of index? I think the selected point should be determined by the id stored in the indices_ vector at this point.

And what about the lines 129 and 137? Is it the same there?

Can anybody confirm this?

good first issue bug filters

Most helpful comment

Hi, great to hear!

You should always use indices_ vector. It will be either an actual indices vector provided by the user, of a "fake" one generated inside initCompute. Either way, it will always contain valid indices.

To be honest, I don't know what was the intention behind use_indices_. I don't see any algorithms that actually use it.

All 6 comments

I think you've discovered a bug. A pull request is welcome. If you have some additional time to spare, please extend our existing unit test in test/filters/test_clipper to cover this bug.

Sorry for the late answer. I don't have much time to spend at the moment. Maybe I can try to fix it next month if no one else fixed it until then. ;-)

Hello everybody.
I'm working on a fix and new tests about Cropbox.
I have a problem with the PCLBase arguments and method. It provides a indices vector (PCLBase::indices_) which is filled on the PCLBase::initComput method. When I want to use this protected member, Do I have to check is the PCLBase::use_indices_ var is true before using the indices vector?

Hi, great to hear!

You should always use indices_ vector. It will be either an actual indices vector provided by the user, of a "fake" one generated inside initCompute. Either way, it will always contain valid indices.

To be honest, I don't know what was the intention behind use_indices_. I don't see any algorithms that actually use it.

I'm working on new tests to cover the problem. But in order to catch it, I need to check all indices returned. I didn't see any content verification on other tests, just size check. I don't know what is the best way to perform this without the gmock lib(testing::UnorderedElementsAre).

What about sorting and then comparing one-by-one?

Was this page helpful?
0 / 5 - 0 ratings