Easy3D 2.5.3
PrimitivesRansac Class Reference

Extract primitives from point clouds using RANSAC.Usage example: More...

#include <easy3d/algo/point_cloud_ransac.h>

Classes

struct  CylinderPrim
 
struct  PlanePrim
 

Public Types

enum  PrimType {
  PLANE = 0 , SPHERE = 1 , CYLINDER = 2 , CONE = 3 ,
  TORUS = 4 , UNKNOWN = -1
}
 

Public Member Functions

void add_primitive_type (PrimType t)
 Setup the primitive types to be extracted. More...
 
void remove_primitive_type (PrimType t)
 Exclude a primitive types to be extracted. More...
 
int detect (PointCloud *cloud, unsigned int min_support=1000, float dist_threshold=0.005f, float bitmap_resolution=0.02f, float normal_threshold=0.8f, float overlook_probability=0.001f)
 Extract primitives from a point cloud. More...
 
int detect (PointCloud *cloud, const std::vector< int > &vertices, unsigned int min_support=1000, float dist_threshold=0.005f, float bitmap_resolution=0.02f, float normal_threshold=0.8f, float overlook_probability=0.001f)
 Extract primitives from a subset of a point cloud.. More...
 
const std::vector< PlanePrim > & get_planes () const
 
const std::vector< CylinderPrim > & get_cylinders () const
 

Detailed Description

Extract primitives from point clouds using RANSAC.

Usage example:

PrimitivesRansac ransac;
ransac.add_primitive_type(PrimitivesRansac::PLANE);
int num = ransac.detect(cloud);
Examples
Tutorial_703_Cloud_PlaneExtraction.

Member Function Documentation

◆ add_primitive_type()

void add_primitive_type ( PrimType  t)

Setup the primitive types to be extracted.

This is done by adding the interested primitive types one by one.

Examples
Tutorial_703_Cloud_PlaneExtraction.

◆ detect() [1/2]

int detect ( PointCloud cloud,
const std::vector< int > &  vertices,
unsigned int  min_support = 1000,
float  dist_threshold = 0.005f,
float  bitmap_resolution = 0.02f,
float  normal_threshold = 0.8f,
float  overlook_probability = 0.001f 
)

Extract primitives from a subset of a point cloud..

The extracted primitives are stored as properties:

  • "v:primitive_type" (one of PLANE, SPHERE, CYLINDER, CONE, TORUS, and UNKNOWN)
  • "v:primitive_index" (-1, 0, 1, 2...). -1 meaning a vertex does not belong to any primitive (thus its primitive_type must be UNKNOWN.
    Parameters
    cloudThe input point cloud.
    verticesThe indices of the subset of the input point cloud.
    min_supportThe minimal number of points required for a primitive.
    dist_thresholdThe distance threshold, defined relative to the bounding box's max dimension.
    bitmap_resolutionThe bitmap resolution, defined relative to the bounding box width.
    normal_thresholdThe cosine of the maximal normal deviation.
    overlook_probabilityThe probability with which a primitive is overlooked.
    Returns
    The number of extracted primitives.

◆ detect() [2/2]

int detect ( PointCloud cloud,
unsigned int  min_support = 1000,
float  dist_threshold = 0.005f,
float  bitmap_resolution = 0.02f,
float  normal_threshold = 0.8f,
float  overlook_probability = 0.001f 
)

Extract primitives from a point cloud.

The extracted primitives are stored as properties:

  • "v:primitive_type" (one of PLANE, SPHERE, CYLINDER, CONE, TORUS, and UNKNOWN)
  • "v:primitive_index" (-1, 0, 1, 2...). -1 meaning a vertex does not belong to any primitive (thus its primitive_type must be UNKNOWN.
    Parameters
    cloudThe input point cloud.
    min_supportThe minimal number of points required for a primitive.
    dist_thresholdThe distance threshold, defined relative to the bounding box's max dimension.
    bitmap_resolutionThe bitmap resolution, defined relative to the bounding box width.
    normal_thresholdThe cosine of the maximal normal deviation.
    overlook_probabilityThe probability with which a primitive is overlooked.
    Returns
    The number of extracted primitives.
Examples
Tutorial_703_Cloud_PlaneExtraction.

◆ remove_primitive_type()

void remove_primitive_type ( PrimType  t)

Exclude a primitive types to be extracted.

This is done by removing the primitive type from the existing list.


The documentation for this class was generated from the following files: