PointCloudLibrary / PointCloudLibrary/pcl

Octree depth iterator

Open
#2,548 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: question module: octree needs: code review
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

Hi all
I'm new in PCL, and I don't control C++ iterators, sorry.
Just want to access to the number of node not empty at each level of the octree.
1 8 43 220 904 etc...
The idea was to "scan" the octree at each depth.
Was expected to get the solution with depth iterator, but it doesn't work as hoped.
Does't seem to go down, just give me the number of voxel not empty at the last level:


#include <pcl/octree/octree_impl.h>
...
OctreePointCloudOccupancypcl::PointXYZ BoxTreeO(Resolution);
BoxTreeO.setInputCloud(Cloud);
BoxTreeO.defineBoundingBox(VoxelMin.x, VoxelMin.y, VoxelMin.z, VoxelMax.x, VoxelMax.y, VoxelMax.z);
BoxTreeO.addPointsFromInputCloud();

OctreePointCloudOccupancypcl::PointXYZ::Iterator j;
for (j = BoxTreeO.depth_begin(); j != BoxTreeO.depth_end(); ++j)
{
cout << "Depth:\t\t" << BoxTreeO.getTreeDepth() << endl;
cout << "LeafCount:\t\t" << BoxTreeO.getLeafCount() << endl;
}
BoxTreeO.deleteTree();
return(44);
}


What I am doing wrong, any help please?
Thanks by advance, serge

PCL 1.8.1 All-in-one
MVS 2017
Windows 10.017134

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pcl/octree/octree_impl.h and the OctreePointCloudOccupancy depth_begin()/depth_end() entry points used in the example. Trace how the iterator advances and how getTreeDepth() and getLeafCount() report state; done means the depth scan produces the expected non-empty node count at each level.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.