5. PCL plugin

PCL is a standard plugin of cloudComPy. The plugin implements some methods of the Point Cloud Library (PCL): https://pointclouds.org.

The availability of the plugin can be tested with the cloudComPy.isPluginPCL() function:

isPCL_available = cc.isPluginPCL()

PCL is a submodule of cloudCompy:

import cloudComPy as cc
# ...
if cc.isPluginPCL():
    import cloudComPy.PCL
    fgr = cc.PCL.FastGlobalRegistrationFilter()
    fgr.setParameters(...)
    fgr.compute()
class cloudComPy.PCL.FastGlobalRegistrationFilter

Filter based on “Q.-Y. Zhou, J. Park, and V. Koltun, Fast Global Registration, ECCV, 2016.” See https://github.com/isl-org/FastGlobalRegistration

compute(self: cloudComPy.PCL._PCL.FastGlobalRegistrationFilter) int

Compute the PCL fast registration, using the PCL library. Call FastGlobalRegistrationFilter.setParameters() first! The cloud is moved (no copy of the original).

Returns

success

Return type

bool

getAutoRadius(self: cloudComPy.PCL._PCL.FastGlobalRegistrationFilter) float

Get the radius value proposed by default for PCL registration. FastGlobalRegistrationFilter.setParameters() with radius 0 should be called first to compute the default radius value.

Returns

default radius value

Return type

float

getTransformation(self: cloudComPy.PCL._PCL.FastGlobalRegistrationFilter) _cloudComPy.ccGLMatrix

get the transformation matrix after the PCL fast registration.

Returns

the transformation matrix

Return type

ccGLMatrix

setParameters(self: cloudComPy.PCL._PCL.FastGlobalRegistrationFilter, refCloud: _cloudComPy.ccPointCloud, alignClouds: List[_cloudComPy.ccPointCloud], radius: float = 0.0) None

Defines the reference PointCloud, the list of PointCloud to align and the radius to use for registration.

Parameters
  • refCloud (ccPointCloud) – the reference cloud

  • alignClouds (list) – the list of ccPointCloud to align.

  • radius (float,optional) – radius to use for computation, default 0 (automatic estimation of radius)

class cloudComPy.PCL.NormalEstimation

A tool to compute normals and optionally curvature of a cloud, using the PCL library. See NormalEstimation.setParameters() and NormalEstimation.compute().

compute(self: cloudComPy.PCL._PCL.NormalEstimation) int

compute normals and optionally curvature of a cloud, using the PCL library.

Returns

success

Return type

bool

setParameters(self: cloudComPy.PCL._PCL.NormalEstimation, cloud: _cloudComPy.ccPointCloud, useKnn: bool = False, ovewriteCurvature: bool = True, knn: int = 10, radius: float = 0.0) None

Defines the parameters to use for normals and curvature calculation, using the PCL library.

Parameters
  • cloud (ccPointCloud) – the point cloud

  • useKnn (bool,optional) – default False, whether to use a constant number of neighbors instead of a radius.

  • ovewriteCurvature (bool,optional) – default True, compute curvature, overwrite the existing curvature if present.

  • knn (int,optional) – default 10, number of neighbors (if useKnn is true)

  • radius (double,optional) – default 0. meaning an automatic calculation of radius.

class cloudComPy.PCL.MLSSmoothingUpsampling

Smoothing and normal estimation based on polynomial reconstruction, using the PCL library. See MLSSmoothingUpsampling.setParameters() MLSSmoothingUpsampling.compute()

compute(self: cloudComPy.PCL._PCL.MLSSmoothingUpsampling) int

Compute the smoothing and normals of the cloud, using the PCL library. Call first MLSSmoothingUpsampling.setParameters() Get the result cloud with MLSSmoothingUpsampling.getOutputCloud()

Returns

success

Return type

bool

getOutputCloud(self: cloudComPy.PCL._PCL.MLSSmoothingUpsampling) _cloudComPy.ccPointCloud

Get the resulting cloud after MLSSmoothingUpsampling.compute().

Returns

computed cloud

Return type

ccPointCloud

setParameters(self: cloudComPy.PCL._PCL.MLSSmoothingUpsampling, cloud: _cloudComPy.ccPointCloud, computeNormals: bool = True, searchRadius: float = 0.01, polyfit: bool = True, order: int = 2, sqrGauss: float = 0.0001, upsampleMethod: int = 0, upsampingRadius: float = 0.01, upsamplingStep: float = 0.01, stepPointDensity: int = 4, dilationVoxelSize: float = 0.01, dilationIterations: int = 0) None

Defines the parameters to use for smoothing and normals calculation, using the PCL library.

Parameters
  • cloud (ccPointCloud) – the point cloud

  • computeNormals (bool,optional) – default True

  • searchRadius (float,optional) – default 0.01, radius to use for the computation.

  • polyfit (bool,optional) – default True, whether to fit a polynom to smooth the cloud.

  • order (int,optional) – default 2, polynom order.

  • sqrGauss (float,optional) – default 0.0001, squared Gauss parameter.

  • upsampleMethod (int,optional) – default 0, value from 0=NONE, 1=SAMPLE_LOCAL_PLANE, 2=RANDOM_UNIFORM_DENSITY, 3=VOXEL_GRID_DILATION

  • upsampingRadius (float,optional) – default 0.01, radius to use for upsampling (SAMPLE_LOCAL_PLANE method).

  • upsamplingStep (float,optional) – default 0.01, radius to use for upsampling step size (SAMPLE_LOCAL_PLANE method).

  • stepPointDensity (int,optional) – default 4, step point density (RANDOM_UNIFORM_DENSITY).

  • dilationVoxelSize (float,optional) – default 0.01, dilation voxel size (VOXEL_GRID_DILATION).

  • dilationIterations (int,optional) – default 0 (VOXEL_GRID_DILATION).

cloudComPy.PCL.initTrace_PCL() None

Debug trace must be initialized for each Python module.

Done in module init, following the value of environment variable _CCTRACE_ (“ON” if debug traces wanted)