OpenCV
3.4.20-dev
Open Source Computer Vision
|
Class, allowing the load and matching 3D models. Typical Use: More...
#include <opencv2/surface_matching/ppf_match_3d.hpp>
Public Member Functions | |
PPF3DDetector () | |
Empty constructor. Sets default arguments. More... | |
PPF3DDetector (const double relativeSamplingStep, const double relativeDistanceStep=0.05, const double numAngles=30) | |
virtual | ~PPF3DDetector () |
void | match (const Mat &scene, std::vector< Pose3DPtr > &results, const double relativeSceneSampleStep=1.0/5.0, const double relativeSceneDistance=0.03) |
Matches a trained model across a provided scene. More... | |
void | read (const FileNode &fn) |
void | setSearchParams (const double positionThreshold=-1, const double rotationThreshold=-1, const bool useWeightedClustering=false) |
void | trainModel (const Mat &Model) |
Trains a new model. More... | |
void | write (FileStorage &fs) const |
Protected Member Functions | |
void | clearTrainingModels () |
Protected Attributes | |
double | angle_step |
double | angle_step_radians |
double | angle_step_relative |
double | distance_step |
double | distance_step_relative |
THash * | hash_nodes |
hashtable_int * | hash_table |
int | num_ref_points |
double | position_threshold |
Mat | ppf |
double | rotation_threshold |
Mat | sampled_pc |
double | sampling_step_relative |
int | scene_sample_step |
bool | use_weighted_avg |
Class, allowing the load and matching 3D models. Typical Use:
cv::ppf_match_3d::PPF3DDetector::PPF3DDetector | ( | ) |
Empty constructor. Sets default arguments.
cv::ppf_match_3d::PPF3DDetector::PPF3DDetector | ( | const double | relativeSamplingStep, |
const double | relativeDistanceStep = 0.05 , |
||
const double | numAngles = 30 |
||
) |
Constructor with arguments
[in] | relativeSamplingStep | Sampling distance relative to the object's diameter. Models are first sampled uniformly in order to improve efficiency. Decreasing this value leads to a denser model, and a more accurate pose estimation but the larger the model, the slower the training. Increasing the value leads to a less accurate pose computation but a smaller model and faster model generation and matching. Beware of the memory consumption when using small values. |
[in] | relativeDistanceStep | The discretization distance of the point pair distance relative to the model's diameter. This value has a direct impact on the hashtable. Using small values would lead to too fine discretization, and thus ambiguity in the bins of hashtable. Too large values would lead to no discrimination over the feature vectors and different point pair features would be assigned to the same bin. This argument defaults to the value of RelativeSamplingStep. For noisy scenes, the value can be increased to improve the robustness of the matching against noisy points. |
[in] | numAngles | Set the discretization of the point pair orientation as the number of subdivisions of the angle. This value is the equivalent of RelativeDistanceStep for the orientations. Increasing the value increases the precision of the matching but decreases the robustness against incorrect normal directions. Decreasing the value decreases the precision of the matching but increases the robustness against incorrect normal directions. For very noisy scenes where the normal directions can not be computed accurately, the value can be set to 25 or 20. |
|
virtual |
|
protected |
void cv::ppf_match_3d::PPF3DDetector::match | ( | const Mat & | scene, |
std::vector< Pose3DPtr > & | results, | ||
const double | relativeSceneSampleStep = 1.0/5.0 , |
||
const double | relativeSceneDistance = 0.03 |
||
) |
Matches a trained model across a provided scene.
[in] | scene | Point cloud for the scene |
[out] | results | List of output poses |
[in] | relativeSceneSampleStep | The ratio of scene points to be used for the matching after sampling with relativeSceneDistance. For example, if this value is set to 1.0/5.0, every 5th point from the scene is used for pose estimation. This parameter allows an easy trade-off between speed and accuracy of the matching. Increasing the value leads to less points being used and in turn to a faster but less accurate pose computation. Decreasing the value has the inverse effect. |
[in] | relativeSceneDistance | Set the distance threshold relative to the diameter of the model. This parameter is equivalent to relativeSamplingStep in the training stage. This parameter acts like a prior sampling with the relativeSceneSampleStep parameter. |
void cv::ppf_match_3d::PPF3DDetector::read | ( | const FileNode & | fn | ) |
void cv::ppf_match_3d::PPF3DDetector::setSearchParams | ( | const double | positionThreshold = -1 , |
const double | rotationThreshold = -1 , |
||
const bool | useWeightedClustering = false |
||
) |
Set the parameters for the search
[in] | positionThreshold | Position threshold controlling the similarity of translations. Depends on the units of calibration/model. |
[in] | rotationThreshold | Position threshold controlling the similarity of rotations. This parameter can be perceived as a threshold over the difference of angles |
[in] | useWeightedClustering | The algorithm by default clusters the poses without weighting. A non-zero value would indicate that the pose clustering should take into account the number of votes as the weights and perform a weighted averaging instead of a simple one. |
void cv::ppf_match_3d::PPF3DDetector::trainModel | ( | const Mat & | Model | ) |
Trains a new model.
[in] | Model | The input point cloud with normals (Nx6) |
Uses the parameters set in the constructor to downsample and learn a new model. When the model is learnt, the instance gets ready for calling "match".
void cv::ppf_match_3d::PPF3DDetector::write | ( | FileStorage & | fs | ) | const |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |