Point Cloud Library (PCL) 1.15.1
Loading...
Searching...
No Matches
pcl::recognition::ModelLibrary Class Reference

#include <pcl/recognition/ransac_based/model_library.h>

Classes

class  Model
 Stores some information about the model. More...

Public Types

using PointCloudIn = pcl::PointCloud<pcl::PointXYZ>
using PointCloudN = pcl::PointCloud<pcl::Normal>
using node_data_pair_list = std::list<std::pair<const ORROctree::Node::Data*, const ORROctree::Node::Data*> >
using HashTableCell = std::map<const Model*, node_data_pair_list>
using HashTable = VoxelStructure<HashTableCell, float>

Public Member Functions

 ModelLibrary (float pair_width, float voxel_size, float max_coplanarity_angle=3.0f *AUX_DEG_TO_RADIANS)
 This class is used by 'ObjRecRANSAC' to maintain the object models to be recognized.
virtual ~ModelLibrary ()
void removeAllModels ()
 Removes all models from the library and clears the hash table.
void setMaxCoplanarityAngleDegrees (float max_coplanarity_angle_degrees)
 This is a threshold.
void ignoreCoplanarPointPairsOn ()
 Call this method in order NOT to add co-planar point pairs to the hash table.
void ignoreCoplanarPointPairsOff ()
 Call this method in order to add all point pairs (co-planar as well) to the hash table.
bool addModel (const PointCloudIn &points, const PointCloudN &normals, const std::string &object_name, float frac_of_points_for_registration, void *user_data=nullptr)
 Adds a model to the hash table.
const HashTablegetHashTable () const
 Returns the hash table built by this instance.
const ModelgetModel (const std::string &name) const
const std::map< std::string, Model * > & getModels () const

Protected Member Functions

void clear ()
 Removes all models from the library and destroys the hash table.
bool addToHashTable (Model *model, const ORROctree::Node::Data *data1, const ORROctree::Node::Data *data2)
 Returns true if the oriented point pair was added to the hash table and false otherwise.

Protected Attributes

float pair_width_
float voxel_size_
float max_coplanarity_angle_
bool ignore_coplanar_opps_ {true}
std::map< std::string, Model * > models_
HashTable hash_table_
int num_of_cells_ [3]

Detailed Description

Definition at line 57 of file model_library.h.

Member Typedef Documentation

◆ HashTable

◆ HashTableCell

Definition at line 171 of file model_library.h.

◆ node_data_pair_list

Definition at line 170 of file model_library.h.

◆ PointCloudIn

◆ PointCloudN

Constructor & Destructor Documentation

◆ ModelLibrary()

pcl::recognition::ModelLibrary::ModelLibrary ( float pair_width,
float voxel_size,
float max_coplanarity_angle = 3.0f *AUX_DEG_TO_RADIANS )

This class is used by 'ObjRecRANSAC' to maintain the object models to be recognized.

Normally, you do not need to use this class directly.

◆ ~ModelLibrary()

virtual pcl::recognition::ModelLibrary::~ModelLibrary ( )
inlinevirtual

Definition at line 178 of file model_library.h.

References clear().

Member Function Documentation

◆ addModel()

bool pcl::recognition::ModelLibrary::addModel ( const PointCloudIn & points,
const PointCloudN & normals,
const std::string & object_name,
float frac_of_points_for_registration,
void * user_data = nullptr )

Adds a model to the hash table.

Parameters
[in]pointsrepresents the model to be added.
[in]normalsare the normals at the model points.
[in]object_nameis the unique name of the object to be added.
[in]frac_of_points_for_registrationis the number of points used for fast ICP registration prior to hypothesis testing
[in]user_datais a pointer to some data (can be NULL)

Returns true if model successfully added and false otherwise (e.g., if object_name is not unique).

◆ addToHashTable()

bool pcl::recognition::ModelLibrary::addToHashTable ( Model * model,
const ORROctree::Node::Data * data1,
const ORROctree::Node::Data * data2 )
protected

Returns true if the oriented point pair was added to the hash table and false otherwise.

◆ clear()

void pcl::recognition::ModelLibrary::clear ( )
protected

Removes all models from the library and destroys the hash table.

This method should be called upon destroying this object.

Referenced by ~ModelLibrary().

◆ getHashTable()

const HashTable & pcl::recognition::ModelLibrary::getHashTable ( ) const
inline

Returns the hash table built by this instance.

Definition at line 227 of file model_library.h.

References hash_table_.

◆ getModel()

const Model * pcl::recognition::ModelLibrary::getModel ( const std::string & name) const
inline

Definition at line 233 of file model_library.h.

References models_.

◆ getModels()

const std::map< std::string, Model * > & pcl::recognition::ModelLibrary::getModels ( ) const
inline

Definition at line 243 of file model_library.h.

References models_.

◆ ignoreCoplanarPointPairsOff()

void pcl::recognition::ModelLibrary::ignoreCoplanarPointPairsOff ( )
inline

Call this method in order to add all point pairs (co-planar as well) to the hash table.

The default behavior is ignoring co-planar points on.

Definition at line 207 of file model_library.h.

References ignore_coplanar_opps_.

◆ ignoreCoplanarPointPairsOn()

void pcl::recognition::ModelLibrary::ignoreCoplanarPointPairsOn ( )
inline

Call this method in order NOT to add co-planar point pairs to the hash table.

The default behavior is ignoring co-planar points on.

Definition at line 199 of file model_library.h.

References ignore_coplanar_opps_.

◆ removeAllModels()

void pcl::recognition::ModelLibrary::removeAllModels ( )

Removes all models from the library and clears the hash table.

◆ setMaxCoplanarityAngleDegrees()

void pcl::recognition::ModelLibrary::setMaxCoplanarityAngleDegrees ( float max_coplanarity_angle_degrees)
inline

This is a threshold.

The larger the value the more point pairs will be considered as co-planar and will be ignored in the off-line model pre-processing and in the online recognition phases. This makes sense only if "ignore co-planar points" is on. Call this method before calling addModel.

Definition at line 191 of file model_library.h.

References max_coplanarity_angle_.

Member Data Documentation

◆ hash_table_

HashTable pcl::recognition::ModelLibrary::hash_table_
protected

Definition at line 264 of file model_library.h.

Referenced by getHashTable().

◆ ignore_coplanar_opps_

bool pcl::recognition::ModelLibrary::ignore_coplanar_opps_ {true}
protected

Definition at line 261 of file model_library.h.

Referenced by ignoreCoplanarPointPairsOff(), and ignoreCoplanarPointPairsOn().

◆ max_coplanarity_angle_

float pcl::recognition::ModelLibrary::max_coplanarity_angle_
protected

Definition at line 260 of file model_library.h.

Referenced by setMaxCoplanarityAngleDegrees().

◆ models_

std::map<std::string,Model*> pcl::recognition::ModelLibrary::models_
protected

Definition at line 263 of file model_library.h.

Referenced by getModel(), and getModels().

◆ num_of_cells_

int pcl::recognition::ModelLibrary::num_of_cells_[3]
protected

Definition at line 265 of file model_library.h.

◆ pair_width_

float pcl::recognition::ModelLibrary::pair_width_
protected

Definition at line 258 of file model_library.h.

◆ voxel_size_

float pcl::recognition::ModelLibrary::voxel_size_
protected

Definition at line 259 of file model_library.h.


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