Search code examples
3dcgal

CGAL 4.10 Point Set Shape Detection: preventing detection of spurious planes on curved surfaces


I'm using CGAL Point Set Shape Detection to find planes in a point cloud. The method does a good job of detecting the planes in the model, but it also detects a number of spurious planes, which are not really part of the model. E.g. my model has a long pipe, and the algorithm detects a few planes running along the length of the pipe, tangential to its surface. The only way I can think to avoid this is to use smaller values for epsilon and/or normal_threshold. I am already using quite small values for epsilon and normal_threshold (currently at 1.0 and 0.35, respectively).

Is this a common problem and is there another way to avoid it?


Solution

  • It's an expected behavior of the algorithm: if you have a sufficiently long cylinder so that the algorithm can fit a plane tangentially with enough points below the tolerance, then it can be detected. There is no notion of thickness or elongation inside the detected plane.

    If you increase the minimum number of points or decrease the tolerances, you might get rid of these shapes but at the cost of loosing other ones that might be of interest to you.

    My advise would be to filter these planes that you don't want afterwards (for example, you can identify the principal component vectors with CGAL::linear_least_squares_fitting_3() and estimate the thickness of the detected shape, then remove if it is too small).