This is a RANSAC-based 3D object recognition method. More...
#include <pcl/recognition/ransac_based/obj_rec_ransac.h>
|
int |
computeNumberOfIterations (double success_probability) const |
void |
clearTestData () |
void |
sampleOrientedPointPairs (int num_iterations, const std::vector< ORROctree::Node * > &full_scene_leaves, std::list< OrientedPointPair > &output) const |
int |
generateHypotheses (const std::list< OrientedPointPair > &pairs, std::list< HypothesisBase > &out) const |
int |
groupHypotheses (std::list< HypothesisBase > &hypotheses, int num_hypotheses, RigidTransformSpace &transform_space, HypothesisOctree &grouped_hypotheses) const |
|
Groups close hypotheses in 'hypotheses'. More...
|
void |
testHypothesis (Hypothesis *hypothesis, int &match, int &penalty) const |
void |
testHypothesisNormalBased (Hypothesis *hypothesis, float &match) const |
void |
buildGraphOfCloseHypotheses (HypothesisOctree &hypotheses, ORRGraph< Hypothesis > &graph) const |
void |
filterGraphOfCloseHypotheses (ORRGraph< Hypothesis > &graph, std::vector< Hypothesis > &out) const |
void |
buildGraphOfConflictingHypotheses (const BVHH &bvh, ORRGraph< Hypothesis * > &graph) const |
void |
filterGraphOfConflictingHypotheses (ORRGraph< Hypothesis * > &graph, std::list< ObjRecRANSAC::Output > &recognized_objects) const |
void |
computeRigidTransform (const float *a1, const float *a1_n, const float *b1, const float *b1_n, const float *a2, const float *a2_n, const float *b2, const float *b2_n, float *rigid_transform) const |
|
Computes the rigid transform that maps the line (a1, b1) to (a2, b2). More...
|
|
static void |
compute_oriented_point_pair_signature (const float *p1, const float *n1, const float *p2, const float *n2, float signature[3]) |
|
Computes the signature of the oriented point pair ((p1, n1), (p2, n2)) consisting of the angles between. More...
|
This is a RANSAC-based 3D object recognition method.
Do the following to use it: (i) call addModel() k times with k different models representing the objects to be recognized and (ii) call recognize() with the 3D scene in which the objects should be recognized. Recognition means both object identification and pose (position + orientation) estimation. Check the method descriptions for more details.
-
Note
-
If you use this code in any academic work, please cite:
- Chavdar Papazov, Sami Haddadin, Sven Parusel, Kai Krieger and Darius Burschka. Rigid 3D geometry matching for grasping of known objects in cluttered scenes. The International Journal of Robotics Research 2012. DOI: 10.1177/0278364911436019
- Chavdar Papazov and Darius Burschka. An Efficient RANSAC for 3D Object Recognition in Noisy and Occluded Scenes. In Proceedings of the 10th Asian Conference on Computer Vision (ACCV'10), November 2010.
-
Author
-
Chavdar Papazov
Definition at line 83 of file obj_rec_ransac.h.
BVHH
HypothesisOctree
PointCloudIn
PointCloudN
Recognition_Mode
Enumerator |
SAMPLE_OPP |
|
TEST_HYPOTHESES |
|
FULL_RECOGNITION |
|
Definition at line 323 of file obj_rec_ransac.h.
ObjRecRANSAC()
pcl::recognition::ObjRecRANSAC::ObjRecRANSAC |
( |
float |
pair_width, |
|
|
float |
voxel_size |
|
) |
|
|
Constructor with some important parameters which can not be changed once an instance of that class is created.
-
Parameters
-
[in] |
pair_width |
should be roughly half the extent of the visible object part. This means, for each object point p there should be (at least) one point q (from the same object) such that ||p - q|| <= pair_width. Tradeoff: smaller values allow for detection in more occluded scenes but lead to more imprecise alignment. Bigger values lead to better alignment but require large visible object parts (i.e., less occlusion). |
[in] |
voxel_size |
is the size of the leafs of the octree, i.e., the "size" of the discretization. Tradeoff: High values lead to less computation time but ignore object details. Small values allow to better distinguish between objects, but will introduce more holes in the resulting "voxel-surface" (especially for a sparsely sampled scene). |
~ObjRecRANSAC()
virtual pcl::recognition::ObjRecRANSAC::~ObjRecRANSAC |
( |
|
) |
|
|
inlinevirtual |
addModel()
bool pcl::recognition::ObjRecRANSAC::addModel |
( |
const PointCloudIn & |
points, |
|
|
const PointCloudN & |
normals, |
|
|
const std::string & |
object_name, |
|
|
void * |
user_data = nullptr |
|
) |
|
|
|
inline |
Add an object model to be recognized.
-
Parameters
-
[in] |
points |
are the object points. |
[in] |
normals |
at each point. |
[in] |
object_name |
is an identifier for the object. If that object is detected in the scene 'object_name' is returned by the recognition method and you know which object has been detected. Note that 'object_name' has to be unique! |
[in] |
user_data |
is a pointer to some data (can be NULL) |
The method returns true if the model was successfully added to the model library and false otherwise (e.g., if 'object_name' is already in use).
Definition at line 227 of file obj_rec_ransac.h.
buildGraphOfCloseHypotheses()
buildGraphOfConflictingHypotheses()
void pcl::recognition::ObjRecRANSAC::buildGraphOfConflictingHypotheses |
( |
const BVHH & |
bvh, |
|
|
ORRGraph< Hypothesis * > & |
graph |
|
) |
|
const |
|
protected |
clear()
void pcl::recognition::ObjRecRANSAC::clear |
( |
|
) |
|
|
inline |
Removes all models from the model library and releases some memory dynamically allocated by this instance.
Definition at line 160 of file obj_rec_ransac.h.
clearTestData()
void pcl::recognition::ObjRecRANSAC::clearTestData |
( |
|
) |
|
|
inlineprotected |
compute_oriented_point_pair_signature()
static void pcl::recognition::ObjRecRANSAC::compute_oriented_point_pair_signature |
( |
const float * |
p1, |
|
|
const float * |
n1, |
|
|
const float * |
p2, |
|
|
const float * |
n2, |
|
|
float |
signature[3] |
|
) |
|
|
|
inlinestaticprotected |
computeNumberOfIterations()
int pcl::recognition::ObjRecRANSAC::computeNumberOfIterations |
( |
double |
success_probability |
) |
const |
|
inlineprotected |
void pcl::recognition::ObjRecRANSAC::computeRigidTransform |
( |
const float * |
a1, |
|
|
const float * |
a1_n, |
|
|
const float * |
b1, |
|
|
const float * |
b1_n, |
|
|
const float * |
a2, |
|
|
const float * |
a2_n, |
|
|
const float * |
b2, |
|
|
const float * |
b2_n, |
|
|
float * |
rigid_transform |
|
) |
|
const |
|
inlineprotected |
Computes the rigid transform that maps the line (a1, b1) to (a2, b2).
The computation is based on the corresponding points 'a1' <-> 'a2' and 'b1' <-> 'b2' and the normals 'a1_n', 'b1_n', 'a2_n', and 'b2_n'. The result is saved in 'rigid_transform' which is an array of length 12. The first 9 elements are the rotational part (row major order) and the last 3 are the translation.
Definition at line 386 of file obj_rec_ransac.h.
References pcl::recognition::aux::cross3(), pcl::recognition::aux::diff3(), pcl::recognition::aux::mult3x3(), pcl::recognition::aux::normalize3(), pcl::recognition::aux::projectOnPlane3(), and pcl::recognition::aux::sum3().
enterTestModeSampleOPP()
void pcl::recognition::ObjRecRANSAC::enterTestModeSampleOPP |
( |
|
) |
|
|
inline |
enterTestModeTestHypotheses()
void pcl::recognition::ObjRecRANSAC::enterTestModeTestHypotheses |
( |
|
) |
|
|
inline |
filterGraphOfCloseHypotheses()
filterGraphOfConflictingHypotheses()
generateHypotheses()
getAcceptedHypotheses() [1/2]
const std::vector<Hypothesis>& pcl::recognition::ObjRecRANSAC::getAcceptedHypotheses |
( |
|
) |
const |
|
inline |
This function is useful for testing purposes.
It returns the accepted hypotheses generated during the recognition process. Makes sense only if some of the testing modes are active.
Definition at line 272 of file obj_rec_ransac.h.
getAcceptedHypotheses() [2/2]
void pcl::recognition::ObjRecRANSAC::getAcceptedHypotheses |
( |
std::vector< Hypothesis > & |
out |
) |
const |
|
inline |
This function is useful for testing purposes.
It returns the accepted hypotheses generated during the recognition process. Makes sense only if some of the testing modes are active.
Definition at line 280 of file obj_rec_ransac.h.
getHashTable()
getModel()
const ModelLibrary::Model* pcl::recognition::ObjRecRANSAC::getModel |
( |
const std::string & |
name |
) |
const |
|
inline |
getModelLibrary()
const ModelLibrary& pcl::recognition::ObjRecRANSAC::getModelLibrary |
( |
|
) |
const |
|
inline |
getPairWidth()
float pcl::recognition::ObjRecRANSAC::getPairWidth |
( |
|
) |
const |
|
inline |
getSampledOrientedPointPairs()
This function is useful for testing purposes.
It returns the oriented point pairs which were sampled from the scene during the recognition process. Makes sense only if some of the testing modes are active.
Definition at line 264 of file obj_rec_ransac.h.
getSceneOctree()
const ORROctree& pcl::recognition::ObjRecRANSAC::getSceneOctree |
( |
|
) |
const |
|
inline |
groupHypotheses()
Groups close hypotheses in 'hypotheses'.
Saves a representative for each group in 'out'. Returns the number of hypotheses after grouping.
icpHypothesesRefinementOff()
void pcl::recognition::ObjRecRANSAC::icpHypothesesRefinementOff |
( |
|
) |
|
|
inline |
icpHypothesesRefinementOn()
void pcl::recognition::ObjRecRANSAC::icpHypothesesRefinementOn |
( |
|
) |
|
|
inline |
ignoreCoplanarPointPairsOff()
void pcl::recognition::ObjRecRANSAC::ignoreCoplanarPointPairsOff |
( |
|
) |
|
|
inline |
Default is on.
This method calls the corresponding method of the model library.
Definition at line 197 of file obj_rec_ransac.h.
ignoreCoplanarPointPairsOn()
void pcl::recognition::ObjRecRANSAC::ignoreCoplanarPointPairsOn |
( |
|
) |
|
|
inline |
Default is on.
This method calls the corresponding method of the model library.
Definition at line 189 of file obj_rec_ransac.h.
leaveTestMode()
void pcl::recognition::ObjRecRANSAC::leaveTestMode |
( |
|
) |
|
|
inline |
recognize()
This method performs the recognition of the models loaded to the model library with the method addModel().
-
Parameters
-
[in] |
scene |
is the 3d scene in which the object should be recognized. |
[in] |
normals |
are the scene normals. |
[out] |
recognized_objects |
is the list of output items each one containing the recognized model instance, its name, the aligning rigid transform and the match confidence (see ObjRecRANSAC::Output for further explanations). |
[in] |
success_probability |
is the user-defined probability of detecting all objects in the scene. |
sampleOrientedPointPairs()
void pcl::recognition::ObjRecRANSAC::sampleOrientedPointPairs |
( |
int |
num_iterations, |
|
|
const std::vector< ORROctree::Node * > & |
full_scene_leaves, |
|
|
std::list< OrientedPointPair > & |
output |
|
) |
|
const |
|
protected |
setMaxCoplanarityAngleDegrees()
void pcl::recognition::ObjRecRANSAC::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. This method calls the corresponding method of the model library.
Definition at line 175 of file obj_rec_ransac.h.
setSceneBoundsEnlargementFactor()
void pcl::recognition::ObjRecRANSAC::setSceneBoundsEnlargementFactor |
( |
float |
value |
) |
|
|
inline |
testHypothesis()
void pcl::recognition::ObjRecRANSAC::testHypothesis |
( |
Hypothesis * |
hypothesis, |
|
|
int & |
match, |
|
|
int & |
penalty |
|
) |
|
const |
|
inlineprotected |
testHypothesisNormalBased()
void pcl::recognition::ObjRecRANSAC::testHypothesisNormalBased |
( |
Hypothesis * |
hypothesis, |
|
|
float & |
match |
|
) |
|
const |
|
inlineprotected |
ModelLibrary
abs_zdist_thresh_
float pcl::recognition::ObjRecRANSAC::abs_zdist_thresh_ |
|
protected |
accepted_hypotheses_
std::vector<Hypothesis> pcl::recognition::ObjRecRANSAC::accepted_hypotheses_ |
|
protected |
do_icp_hypotheses_refinement_
bool pcl::recognition::ObjRecRANSAC::do_icp_hypotheses_refinement_ |
|
protected |
frac_of_points_for_icp_refinement_
float pcl::recognition::ObjRecRANSAC::frac_of_points_for_icp_refinement_ |
|
protected |
ignore_coplanar_opps_
bool pcl::recognition::ObjRecRANSAC::ignore_coplanar_opps_ |
|
protected |
intersection_fraction_
float pcl::recognition::ObjRecRANSAC::intersection_fraction_ |
|
protected |
max_coplanarity_angle_
float pcl::recognition::ObjRecRANSAC::max_coplanarity_angle_ |
|
protected |
model_library_
pair_width_
float pcl::recognition::ObjRecRANSAC::pair_width_ |
|
protected |
position_discretization_
float pcl::recognition::ObjRecRANSAC::position_discretization_ |
|
protected |
rec_mode_
relative_num_of_illegal_pts_
float pcl::recognition::ObjRecRANSAC::relative_num_of_illegal_pts_ |
|
protected |
relative_obj_size_
float pcl::recognition::ObjRecRANSAC::relative_obj_size_ |
|
protected |
rotation_discretization_
float pcl::recognition::ObjRecRANSAC::rotation_discretization_ |
|
protected |
sampled_oriented_point_pairs_
std::list<OrientedPointPair> pcl::recognition::ObjRecRANSAC::sampled_oriented_point_pairs_ |
|
protected |
scene_bounds_enlargement_factor_
float pcl::recognition::ObjRecRANSAC::scene_bounds_enlargement_factor_ |
|
protected |
scene_octree_
ORROctree pcl::recognition::ObjRecRANSAC::scene_octree_ |
|
protected |
scene_octree_points_
scene_octree_proj_
trimmed_icp_
visibility_
float pcl::recognition::ObjRecRANSAC::visibility_ |
|
protected |
voxel_size_
float pcl::recognition::ObjRecRANSAC::voxel_size_ |
|
protected |
The documentation for this class was generated from the following file: