9. RANSAC_SD plugin

RANSAC_SD is a standard plugin of cloudComPy.

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

isRANSAC_SD_available = cc.isPluginRANSAC_SD()

RANSAC_SD is a submodule of cloudCompy:

import cloudComPy as cc
# ...
if cc.isPluginRANSAC_SD():
    import cloudComPy.RANSAC_SD
    params = cc.RANSAC_SD.RansacParams()
    results = cc.RANSAC_SD.computeRANSAC_SD(cloud, params)
class cloudComPy.RANSAC_SD.RansacParams

RANSAC_SD parameters

__init__(self: _RANSAC_SD.RansacParams) None

RANSAC_SD parameters default constructor

property allowFitting

Use Least Squares fitting on found shapes, default True.

property allowSimplification

Attempt to simplify shapes. Will attempt to convert torus, cones, spheres, cylinders into simpler shapes. For instance, cones may be simplified into cylinder, sphere or plane. Default True.

property bitmapEpsilon

Sampling resolution, should correspond to the average distance of neighbors points in data, default 0.001.

property createCloudFromLeftOverPoints

Save leftover points into a new cloud, default True.

property epsilon

Maximum distance if the samples to the ideal shape, default 0.005.

getPrimEnabled(self: _RANSAC_SD.RansacParams, arg0: _RANSAC_SD.RANSAC_PRIMITIVE_TYPES) bool

Check the type of primitive (plane, sphere, cylinder, cone, torus) enabled. By default, plane, sphere, cylinder are enabled. Types of primitive are from:

  • RANSAC_PRIMITIVE_TYPES.RPT_PLANE

  • RANSAC_PRIMITIVE_TYPES.RPT_SPHERE

  • RANSAC_PRIMITIVE_TYPES.RPT_CYLINDER

  • RANSAC_PRIMITIVE_TYPES.RPT_CONE

  • RANSAC_PRIMITIVE_TYPES.RPT_TORUS

Parameters:

rpt (RANSAC_PRIMITIVE_TYPES) – type of primitive

Returns:

whether the type is enabled or not

Return type:

bool

property maxConeAngle_deg

Maximum cone angle, default +infinity.

property maxConeLength

Maximum cone length, default +infinity.

property maxConeRadius

Maximum cone radius, default +infinity.

property maxCylinderLength

Maximum cylinder length, default +infinity.

property maxCylinderRadius

Maximum cylinder radius, default +infinity.

property maxNormalDev_deg

Maximum deviation from the ideal shape normal vector (in degrees), default 25.

property maxSphereRadius

Maximum sphere radius, default +infinity.

property maxTorusMajorRadius

Maximum tore major radius, default +infinity.

property maxTorusMinorRadius

Maximum tore minor radius, default +infinity.

property minCylinderRadius

Minimum cylinder radius, default -infinity.

property minSphereRadius

Minimum sphere radius, default -infinity.

property minTorusMajorRadius

Minimum tore major radius, default -infinity.

property minTorusMinorRadius

Minimum tore minor radius, default -infinity.

optimizeForCloud(self: _RANSAC_SD.RansacParams, arg0: _cloudComPy.ccPointCloud) None

Sets values for epsilon and bitmapEpsilon based on the cloud bounding box, maximum dimension. epsilon is set to 0.005 * maxDim, bitmapEpsilon is set to 0.01 * maxDim.

Parameters:

cloud (ccPointCloud) – the cloud to be analyzed.

property probability

Probability that no better candidate was overlooked during the sampling, the lower the better, default 0.01

property randomColor

Set random color for each shape found, default True.

setPrimEnabled(self: _RANSAC_SD.RansacParams, arg0: _RANSAC_SD.RANSAC_PRIMITIVE_TYPES, arg1: bool) None

Define the type of primitive (plane, sphere, cylinder, cone, torus) enabled. By default, plane, sphere, cylinder are enabled. Types of primitive are from:

  • RANSAC_PRIMITIVE_TYPES.RPT_PLANE

  • RANSAC_PRIMITIVE_TYPES.RPT_SPHERE

  • RANSAC_PRIMITIVE_TYPES.RPT_CYLINDER

  • RANSAC_PRIMITIVE_TYPES.RPT_CONE

  • RANSAC_PRIMITIVE_TYPES.RPT_TORUS

Parameters:
  • rpt (RANSAC_PRIMITIVE_TYPES) – type of primitive

  • isEnabled (bool) – whether the type is enabled or not

property supportPoints

Minimal number of points required to define a primitive, default 500.

cloudComPy.RANSAC_SD.computeRANSAC_SD(arg0: _cloudComPy.ccPointCloud, arg1: _RANSAC_SD.RansacParams) tuple

RANSAC Shape Detection is a simple interface to the automatic shape detection algorithm proposed by Ruwen Schnabel et al. of Bonn university (Efficient RANSAC for Point-Cloud Shape Detection).

cloudComPy.RANSAC_SD.initTrace_RANSAC_SD() 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)