OpenCV  3.4.19
Open Source Computer Vision
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cv::ppf_match_3d::PPF3DDetector Class Reference

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
 
THashhash_nodes
 
hashtable_inthash_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
 

Detailed Description

Class, allowing the load and matching 3D models. Typical Use:

// Train a model
ppf_match_3d::PPF3DDetector detector(0.05, 0.05);
detector.trainModel(pc);
// Search the model in a given scene
vector<Pose3DPtr> results;
detector.match(pcTest, results, 1.0/5.0,0.05);

Constructor & Destructor Documentation

◆ PPF3DDetector() [1/2]

cv::ppf_match_3d::PPF3DDetector::PPF3DDetector ( )

Empty constructor. Sets default arguments.

◆ PPF3DDetector() [2/2]

cv::ppf_match_3d::PPF3DDetector::PPF3DDetector ( const double  relativeSamplingStep,
const double  relativeDistanceStep = 0.05,
const double  numAngles = 30 
)

Constructor with arguments

Parameters
[in]relativeSamplingStepSampling 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]relativeDistanceStepThe 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]numAnglesSet 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.

◆ ~PPF3DDetector()

virtual cv::ppf_match_3d::PPF3DDetector::~PPF3DDetector ( )
virtual

Member Function Documentation

◆ clearTrainingModels()

void cv::ppf_match_3d::PPF3DDetector::clearTrainingModels ( )
protected

◆ match()

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.

Parameters
[in]scenePoint cloud for the scene
[out]resultsList of output poses
[in]relativeSceneSampleStepThe 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]relativeSceneDistanceSet 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.

◆ read()

void cv::ppf_match_3d::PPF3DDetector::read ( const FileNode fn)

◆ setSearchParams()

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

Parameters
[in]positionThresholdPosition threshold controlling the similarity of translations. Depends on the units of calibration/model.
[in]rotationThresholdPosition threshold controlling the similarity of rotations. This parameter can be perceived as a threshold over the difference of angles
[in]useWeightedClusteringThe 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.

◆ trainModel()

void cv::ppf_match_3d::PPF3DDetector::trainModel ( const Mat Model)

Trains a new model.

Parameters
[in]ModelThe 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".

◆ write()

void cv::ppf_match_3d::PPF3DDetector::write ( FileStorage fs) const

Member Data Documentation

◆ angle_step

double cv::ppf_match_3d::PPF3DDetector::angle_step
protected

◆ angle_step_radians

double cv::ppf_match_3d::PPF3DDetector::angle_step_radians
protected

◆ angle_step_relative

double cv::ppf_match_3d::PPF3DDetector::angle_step_relative
protected

◆ distance_step

double cv::ppf_match_3d::PPF3DDetector::distance_step
protected

◆ distance_step_relative

double cv::ppf_match_3d::PPF3DDetector::distance_step_relative
protected

◆ hash_nodes

THash* cv::ppf_match_3d::PPF3DDetector::hash_nodes
protected

◆ hash_table

hashtable_int* cv::ppf_match_3d::PPF3DDetector::hash_table
protected

◆ num_ref_points

int cv::ppf_match_3d::PPF3DDetector::num_ref_points
protected

◆ position_threshold

double cv::ppf_match_3d::PPF3DDetector::position_threshold
protected

◆ ppf

Mat cv::ppf_match_3d::PPF3DDetector::ppf
protected

◆ rotation_threshold

double cv::ppf_match_3d::PPF3DDetector::rotation_threshold
protected

◆ sampled_pc

Mat cv::ppf_match_3d::PPF3DDetector::sampled_pc
protected

◆ sampling_step_relative

double cv::ppf_match_3d::PPF3DDetector::sampling_step_relative
protected

◆ scene_sample_step

int cv::ppf_match_3d::PPF3DDetector::scene_sample_step
protected

◆ use_weighted_avg

bool cv::ppf_match_3d::PPF3DDetector::use_weighted_avg
protected

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