42#include <pcl/recognition/ransac_based/voxel_structure.h>
43#include <pcl/recognition/ransac_based/orr_octree.h>
45#include <pcl/pcl_exports.h>
46#include <pcl/point_cloud.h>
74 const std::vector<ORROctree::Node*>&
full_leaves = octree_.getFullLeaves ();
79 std::vector<ORROctree::Node*>::const_iterator
it =
full_leaves.begin ();
80 const float *p = (*it)->getData ()->getPoint ();
81 aux::copy3 (p, octree_center_of_mass_);
82 bounds_of_octree_points_[0] = bounds_of_octree_points_[1] = p[0];
83 bounds_of_octree_points_[2] = bounds_of_octree_points_[3] = p[1];
84 bounds_of_octree_points_[4] = bounds_of_octree_points_[5] = p[2];
89 aux::add3 (octree_center_of_mass_, (*it)->getData ()->getPoint ());
90 aux::expandBoundingBoxToContainPoint (bounds_of_octree_points_, (*it)->getData ()->getPoint ());
116 aux::copy3 (octree_.getFullLeaves ()[
ids[
rand_pos]]->getData ()->getPoint (), points_for_registration_[i]);
127 inline const std::string&
148 return (octree_center_of_mass_);
154 return (bounds_of_octree_points_);
160 return (points_for_registration_);
166 float octree_center_of_mass_[3];
167 float bounds_of_octree_points_[6];
172 using node_data_pair_list = std::list<std::pair<const ORROctree::Node::Data*, const ORROctree::Node::Data*> >;
203 ignore_coplanar_opps_ =
true;
211 ignore_coplanar_opps_ =
false;
231 return (hash_table_);
237 std::map<std::string,Model*>::const_iterator
it = models_.find (name);
238 if (
it != models_.end () )
244 inline const std::map<std::string,Model*>&
267 int num_of_cells_[3];
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
Stores some information about the model.
const PointCloudIn & getPointsForRegistration() const
void * getUserData() const
const std::string & getObjectName() const
const std::string obj_name_
const float * getBoundsOfOctreePoints() const
Model(const PointCloudIn &points, const PointCloudN &normals, float voxel_size, const std::string &object_name, float frac_of_points_for_registration, void *user_data=nullptr)
const float * getOctreeCenterOfMass() const
PointCloudIn points_for_registration_
const ORROctree & getOctree() const
const std::map< std::string, Model * > & getModels() const
float max_coplanarity_angle_
void clear()
Removes all models from the library and destroys the hash table.
bool ignore_coplanar_opps_
void removeAllModels()
Removes all models from the library and clears 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.
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.
void setMaxCoplanarityAngleDegrees(float max_coplanarity_angle_degrees)
This is a threshold.
const Model * getModel(const std::string &name) const
void ignoreCoplanarPointPairsOff()
Call this method in order to add all point pairs (co-planar as well) to 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.
std::map< const Model *, node_data_pair_list > HashTableCell
std::list< std::pair< const ORROctree::Node::Data *, const ORROctree::Node::Data * > > node_data_pair_list
void ignoreCoplanarPointPairsOn()
Call this method in order NOT to add co-planar point pairs to the hash table.
std::map< std::string, Model * > models_
const HashTable & getHashTable() const
Returns the hash table built by this instance.
That's a very specialized and simple octree class.
Defines all the PCL implemented PointT point type structures.
CloudGenerator class generates a point cloud using some randoom number generator.