Noether  0.0.0
Loading...
Searching...
No Matches
noether::RansacPrimitiveFitMeshModifier Class Referenceabstract

Mesh modifier that fits a specifiable number of model primitives to the input mesh. More...

Detailed Description

This modifier uses RANSAC to sequentially fit primitive models to the input mesh. When a valid model is identified, the inlier vertices are removed from the input mesh into a new sub-mesh. New primitive models are then fitted to the remainder of vertices in the input mesh until either 1) the maximum number of primitive models have been fitted 2) too few inliers remain in the input mesh, or 3) no more valid primitives can be fit to the input mesh.

#include <ransac_primitive_fit_modifier.h>

Inheritance diagram for noether::RansacPrimitiveFitMeshModifier:

Public Member Functions

 RansacPrimitiveFitMeshModifier (float distance_threshold, unsigned min_vertices=1, int max_primitives=-1, unsigned max_iterations=100)
 Constructor.
 
std::vector< pcl::PolygonMesh > modify (const pcl::PolygonMesh &mesh) const override
 

Protected Member Functions

virtual std::shared_ptr< pcl::SampleConsensusModel< pcl::PointXYZ > > createModel (const pcl::PolygonMesh &mesh) const =0
 Creates a sample consensus model for the primitive.
 
virtual pcl::PolygonMesh createSubMesh (const pcl::PolygonMesh &mesh, std::shared_ptr< const pcl::RandomSampleConsensus< pcl::PointXYZ > > ransac) const =0
 Creates a sub-mesh from the results of the model primitive fitting.
 

Protected Attributes

float distance_threshold_
 
unsigned min_vertices_
 
int max_primitives_
 
unsigned max_iterations_
 

Additional Inherited Members

- Public Types inherited from noether::MeshModifier
using Ptr = std::unique_ptr< MeshModifier >
 
using ConstPtr = std::unique_ptr< const MeshModifier >
 

Constructor & Destructor Documentation

◆ RansacPrimitiveFitMeshModifier()

noether::RansacPrimitiveFitMeshModifier::RansacPrimitiveFitMeshModifier ( float  distance_threshold,
unsigned  min_vertices = 1,
int  max_primitives = -1,
unsigned  max_iterations = 100 
)
Parameters
distance_thresholdMaximum distance (m) a point can be from the primitive model to be considered an inlier
min_verticesMinimum number of vertices that a cluster (identfied as a primitive) must have
max_primitivesMaximum number of primitives to detect
max_iterationsMaximum number of RANSAC iterations to perform

Member Function Documentation

◆ modify()

std::vector< pcl::PolygonMesh > noether::RansacPrimitiveFitMeshModifier::modify ( const pcl::PolygonMesh &  mesh) const
overridevirtual

Reimplemented from noether::MeshModifier.

◆ createModel()

virtual std::shared_ptr< pcl::SampleConsensusModel< pcl::PointXYZ > > noether::RansacPrimitiveFitMeshModifier::createModel ( const pcl::PolygonMesh &  mesh) const
protectedpure virtual

◆ createSubMesh()

virtual pcl::PolygonMesh noether::RansacPrimitiveFitMeshModifier::createSubMesh ( const pcl::PolygonMesh &  mesh,
std::shared_ptr< const pcl::RandomSampleConsensus< pcl::PointXYZ > >  ransac 
) const
protectedpure virtual
Parameters
meshFull input mesh
ransacRANSAC model after successful completion of the model primitive fit
Returns

Implemented in noether::RansacCylinderProjectionMeshModifier, noether::RansacCylinderFitMeshModifier, and noether::RansacPlaneProjectionMeshModifier.