Skip to content

Commit aed1a96

Browse files
committed
Octree: grow in positive direction instead of negative
Fixes #5637 The octree must grow if a point lies outside in (at least) one axis. For each axis, the bounding box may be violated in the lower bound, or upper bound, or neither. Currently, in the last case, the tree will grow in the negative direction. With these changes it will instead grow in the positive direction. This is better because the points will be closer to min_*_, which will lead to smaller errors when computing the key. It is necessary to adapt the GFPFH test because GFPFH uses an octree and the feature is influenced by which octree leafs are occupied exactly. Previously, the test cloud resulted in an octree with bounding box (-108;20)(-104;24)(-72;56), with these changes the bounding box is (-12;20)(-12;20)(-12;20), which makes more sense. I am also not sure how much sense this test makes because the test assignes the class labels more or less randomly, while the paper says they should represent a "geometric primitive" (plane, sphere, ...).
1 parent e3bf576 commit aed1a96

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

octree/include/pcl/octree/impl/octree_pointcloud.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,9 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
523523

524524
// octree not empty - we add another tree level and thus increase its size by a
525525
// factor of 2*2*2
526-
child_idx = static_cast<unsigned char>(((!bUpperBoundViolationX) << 2) |
527-
((!bUpperBoundViolationY) << 1) |
528-
((!bUpperBoundViolationZ)));
526+
child_idx = static_cast<unsigned char>(((bLowerBoundViolationX) << 2) |
527+
((bLowerBoundViolationY) << 1) |
528+
((bLowerBoundViolationZ)));
529529

530530
BranchNode* newRootBranch;
531531

@@ -538,13 +538,13 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
538538

539539
octreeSideLen = static_cast<double>(1 << this->octree_depth_) * resolution_;
540540

541-
if (!bUpperBoundViolationX)
541+
if (bLowerBoundViolationX)
542542
min_x_ -= octreeSideLen;
543543

544-
if (!bUpperBoundViolationY)
544+
if (bLowerBoundViolationY)
545545
min_y_ -= octreeSideLen;
546546

547-
if (!bUpperBoundViolationZ)
547+
if (bLowerBoundViolationZ)
548548
min_z_ -= octreeSideLen;
549549

550550
// configure tree depth of octree

test/features/test_pfh_estimation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ TEST (PCL, GFPFH)
504504
PointCloud<GFPFHSignature16> descriptor;
505505
gfpfh.compute (descriptor);
506506

507-
const float ref_values[] = { 1877, 6375, 5361, 14393, 6674, 2471, 2248, 2753, 3117, 4585, 14388, 32407, 15122, 3061, 3202, 794 };
507+
const float ref_values[] = { 1881, 6378, 5343, 14406, 6726, 2379, 2295, 2724, 3177, 4518, 14283, 32341, 15131, 3195, 3238, 813 };
508508

509509
EXPECT_EQ (descriptor.size (), 1);
510510
for (std::size_t i = 0; i < static_cast<std::size_t>(descriptor[0].descriptorSize ()); ++i)

0 commit comments

Comments
 (0)