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

fix octree bounds reducing #1532

Merged
merged 7 commits into from
Jun 27, 2017

Conversation

pkuhto
Copy link
Contributor

@pkuhto pkuhto commented Feb 11, 2016

for some resolution/bounds ratio octree bounds can be unexpectedly reduced

for some resolution/bounds ratio octree bounds can be unexpectedly reduced
@jspricke
Copy link
Member

Interesting, can you add a unit test with an example?

@jkammerl can you have a look?

@pkuhto
Copy link
Contributor Author

pkuhto commented Feb 11, 2016

const double someResolution(10);
const int someDepth(4);
const double desiredMax = ((1<<someDepth) + 0.5)*someResolution;
pcl::octree::OctreePointCloud<PointT> tree(someResolution);
tree.defineBoundingBox(0, 0, 0, desiredMax, desiredMax, desiredMax);
double min_x, min_y, min_z, max_x, max_y, max_z;
tree.getBoundingBox(min_x, min_y, min_z, max_x, max_y, max_z);
assert(max_x >= desiredMax && max_y >= desiredMax && max_z >= desiredMax);

of course bounds can be corrected in adoptBoundingBoxToPoint with treedepth=srcTreeDepth+2 (worst scenario), but I didn't use bounds correction for perfomance reasons and got points in invalid leaves.

@jspricke
Copy link
Member

Can you put this into a unit test and add it to the pull request? That would be great :).

@SergioRAgostinho SergioRAgostinho added the needs: author reply Specify why not closed/merged yet label Jul 14, 2016
@SergioRAgostinho SergioRAgostinho added this to the pcl-1.8.1 milestone Jul 14, 2016
@SergioRAgostinho
Copy link
Member

Nice catch. 👍

  1. Please follow our coding style guide, more specifically notice how the spacing is used before parenthesis.
  2. @jspricke I'm not sure how those ref_values in the GFPFH test were originally calculated, but I have the impression they relied on the bugged implementation of the octree, especially considering it's using the bunny pointcloud and not something much more synthetic that could be manually computed. Can we consider to update them?

@jspricke
Copy link
Member

@SergioRAgostinho I guess they where computed and then later manually verified. If we don't change GFPFH in between, putting in the newly computed values should be fine. @pkuhto can you add that to the pull request as well? Thanks!

@SergioRAgostinho
Copy link
Member

LGTM 👍 Squash all the commits into a single one and this should be good to go.

double min_x2, min_y2, min_z2, max_x2, max_y2, max_z2;
tree.getBoundingBox (min_x2, min_y2, min_z2, max_x2, max_y2, max_z2);

ASSERT_EQ( min_x2 == min_x, true );
Copy link
Member

Choose a reason for hiding this comment

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

Please use ASSERT_DOUBLE_EQ to make assertions about floating-point numbers.

@taketwo
Copy link
Member

taketwo commented Aug 26, 2016

Squash all the commits

@SergioRAgostinho note that Github can do this. You will get an option to squash commits before merging when you press "Merge pull request" button.

@SergioRAgostinho
Copy link
Member

@taketwo Should we squash-merge this and then just submit a minor corrections to those asserts?

@taketwo
Copy link
Member

taketwo commented Jun 27, 2017

Sure. Please merge and I'll make a correction PR.

@SergioRAgostinho SergioRAgostinho merged commit ac6a9c3 into PointCloudLibrary:master Jun 27, 2017
UnaNancyOwen pushed a commit to UnaNancyOwen/pcl that referenced this pull request Nov 24, 2017
- fixed octree bounds reducing, for some resolution/bounds ratio octree bounds can be unexpectedly reduced
- added unit test for octree bounds correction
- fix tree bounds enlarge due to precision issues + unit test, for some testcases it can change tree depth and break tree deserialization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: author reply Specify why not closed/merged yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants