convolution processing

Feel free to ask any question here
Post Reply
fblue
Posts: 37
Joined: Thu Oct 25, 2018 9:00 am

convolution processing

Post by fblue »

Hi Daniel,
How can I apply a convolution processing to a point cloud?
The idea is:
I would like to find edges in a point cloud by applying a 3D matrix mask (3x3x3) through a grid matrix.
The first thing is to have a grid matrix 3D. When I select a point cloud, the bounding box is perfect for me. So how to create a grid matrix 3D by dividing the box into cells? Then I can access each cell by index (x,y,z) to get the sub-points in the cell.
I notice the octree is well construct and very similar to the grid. But how each cell in octree is indexed (by a number?), and how the neighnorhood of each cell is organized?

I'm seaching the methods to get edges and key points in a point Cloud. It will be helpful if you have some advices.
By the way, I noticed there is a plugin qPCL. Does it mean that it's possible to use PCL in CC plateform?

Thanks in advance.
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: convolution processing

Post by daniel »

Well, indeed, this would be perfect for the octree. Especially the CloudCompare octree which really is a kind of smart grid that can be 'scanned' at any subdivision level.

To exploit it directly can be tricky however without knowing its organization and the code well (and sadly there's no real documentation for this). Hopefully the methods of the CCLib::DgmOctree class and their documentation should be sufficient for a first 'brute force' algorithm?

Do you have maybe more precise questions? (don't hesitate)
Daniel, CloudCompare admin
fblue
Posts: 37
Joined: Thu Oct 25, 2018 9:00 am

Re: convolution processing

Post by fblue »

I'm trying to figure out the cell codes and the neighborhood. (Correct me if I'm wrong.)
The method computeOctree() compute the octree of a point cloud from the first to the last level (in X64 bit, 21 levels maximum). A cell code unique is assigned to each point. For a given level n, we can compute the code of the cell where the point lies in by a bitshift of the cell code of this point.

So, for a given cell code, how to find out its adjacent cell neighbors?
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: convolution processing

Post by daniel »

You can deduce the cell code of the neighborhing cells by changing the 3 bits corresponding to the current level (each level is coded on 3 bits: from 0 to 7 - this describes in which sub-cell the point lies relatively to the parent cell).

See how codes are updated in DgmOctree::getNeighborCellsAround. Once you have generated the neighbor cell code, you can find the points that are inside (if any) by looking if their associated code matches.

(P.S.: we don't use PCL in the main CloudCompare application, but indeed in the qPCL plugin. If you develop your own plugin you can virtually use any third party library).
Daniel, CloudCompare admin
fblue
Posts: 37
Joined: Thu Oct 25, 2018 9:00 am

Re: convolution processing

Post by fblue »

In DgmOctree::getNeighborCellsAround(), there is "getCellDistanceFromBorders". What's the value of "neighborhoodlength"? Is it equal to 2 for the case of 26 neighbors? What does the last parameter "CDists" mean exactly? I know it is said to be the distance from cell center to cell neighbourhood INSIDE filled octree?

I rewrote getNeighborCellsAround() and applied it to a cloud in OctreeLevel = 3 just for test. The result of the neighborhood vector(type cellIndexesContainer) confused me. For some cell its size is 0, but the cloud in this octree level has no cell isolated. I don't know why?

Thanks
Bon weekend!
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: convolution processing

Post by daniel »

'neighborhoodlength' is the 'radius' of the neighborhood (total width = 2 * neighborhoodlength + 1)

So indeed, it equals 2 for a 5 x 5 x 5 neighborhood.

I don't know what is the 'CDists' parameter. But getCellDistanceFromBorders is meant to give the actual extents of the neighborhood once cropped with the octree limits. If you are near the border and have a neighborhood of length 5, it may actually be lower on one side (as it's 'truncated' by the octree border).

When you say 'rewrote', what do you mean? (I'm not sure why you need to rewrite it, I may have missed something). Otherwise I think this method is central to CloudCompare's octree and used by so many algorithm that I would trust it by default ;). If it says you don't have any point in a cell, it must be right. I would guess some parameters might be wrong in your case?
Daniel, CloudCompare admin
Post Reply