Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes remove_indices in UniformSampling #1902

Merged
merged 1 commit into from
Sep 3, 2017

Conversation

fran6co
Copy link
Contributor

@fran6co fran6co commented Jun 26, 2017

Fixes #1826

SergioRAgostinho
SergioRAgostinho approved these changes Jun 26, 2017
@SergioRAgostinho SergioRAgostinho added this to the pcl-1.9.0 milestone Jun 26, 2017
@taketwo
Copy link
Member

taketwo commented Jun 26, 2017

I do not understand the logic. Why do we add index to removed_indices_ in line 114? I think that rather lines 122-124 should be like:

// If current point is closer, copy its index instead and mark previous index as removed
if (diff_cur < diff_prev)
{
  removed_indices_.push_back (leaf.idx);
  leaf.idx = (*indices_)[cp];
}

Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the early approval. I didn't look deeply into the problem.

Based on https://travis-ci.org/PointCloudLibrary/pcl/jobs/247089340#L1522 you probably also need to use the full qualified name Filter<PointT>::removed_indices_, or declare an alias in the protected scope of the class, like in the lines 65-68.

@@ -101,6 +109,9 @@ pcl::UniformSampling<PointT>::applyFilter (PointCloud &output)
if (leaf.idx == -1)
{
leaf.idx = (*indices_)[cp];
if (extract_removed_indices_) {
removed_indices_->push_back((*indices_)[cp]]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes no sense. There's no way at this point for you to know if the index in this leaf will be later on substituted in 124. If it ends up never getting replaced, the index should not be removed.

In line 124, like @taketwo pointed out, is where you're sure the index got replaced and dropped.

@@ -72,7 +72,8 @@ namespace pcl
typedef boost::shared_ptr<const UniformSampling<PointT> > ConstPtr;

/** \brief Empty constructor. */
UniformSampling () :
UniformSampling (bool extract_removed_indices = false) :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break the ABI, which pushes things to 1.9.0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we just have two constructors? One parameterless, one with compulsory bool.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to remember to delete it after ^^.

Let's think the other way around, maybe 1.8.1 simply doesn't make sense anymore, it's been more than year. Let's just adopt the new 1.8.0-dev designation and start working on a release with new features, etc... Under that context it's no problem to have the ABI break.

Copy link
Member

@taketwo taketwo Jun 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On one hand, I like this idea. On the other hand, it pushes the next release (whichever number it will have) quite far in the future. What about releasing the current state as 1.8.1 (or 1.9.0) ASAP, and then moving on with merging this PR and other "1.9.0 milestone" features?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM 👍 Let me have a look at that change log and cry a little :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha :) Ok, and I'll work on "-dev".

@fran6co fran6co force-pushed the fix_uniform branch 4 times, most recently from 0265de7 to 4f59c5c Compare June 26, 2017 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: ABI break Meta-information for changelog generation module: filters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants