OpenCV 4.5.3(日本語機械翻訳)
ppf_match_3d.hpp
[詳解]
1 //
2 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
3 //
4 // By downloading, copying, installing or using the software you agree to this license.
5 // If you do not agree to this license, do not download, install,
6 // copy or use the software.
7 //
8 //
9 // License Agreement
10 // For Open Source Computer Vision Library
11 //
12 // Copyright (C) 2014, OpenCV Foundation, all rights reserved.
13 // Third party copyrights are property of their respective owners.
14 //
15 // Redistribution and use in source and binary forms, with or without modification,
16 // are permitted provided that the following conditions are met:
17 //
18 // * Redistribution's of source code must retain the above copyright notice,
19 // this list of conditions and the following disclaimer.
20 //
21 // * Redistribution's in binary form must reproduce the above copyright notice,
22 // this list of conditions and the following disclaimer in the documentation
23 // and/or other materials provided with the distribution.
24 //
25 // * The name of the copyright holders may not be used to endorse or promote products
26 // derived from this software without specific prior written permission.
27 //
28 // This software is provided by the copyright holders and contributors "as is" and
29 // any express or implied warranties, including, but not limited to, the implied
30 // warranties of merchantability and fitness for a particular purpose are disclaimed.
31 // In no event shall the Intel Corporation or contributors be liable for any direct,
32 // indirect, incidental, special, exemplary, or consequential damages
33 // (including, but not limited to, procurement of substitute goods or services;
34 // loss of use, data, or profits; or business interruption) however caused
35 // and on any theory of liability, whether in contract, strict liability,
36 // or tort (including negligence or otherwise) arising in any way out of
37 // the use of this software, even if advised of the possibility of such damage.
38 //
39
59 #ifndef __OPENCV_SURFACE_MATCHING_PPF_MATCH_3D_HPP__
60 #define __OPENCV_SURFACE_MATCHING_PPF_MATCH_3D_HPP__
61
62 #include <opencv2/core.hpp>
63
64 #include <vector>
65 #include "pose_3d.hpp"
66 #include "t_hash_int.hpp"
67
68 namespace cv
69{
70 namespace ppf_match_3d
71{
72
75
79 typedef struct THash
80{
81 int id;
82 int i, ppfInd;
84
97 class CV_EXPORTS_W PPF3DDetector
98{
99 public:
100
104 CV_WRAP PPF3DDetector();
105
112 CV_WRAP PPF3DDetector(const double relativeSamplingStep, const double relativeDistanceStep=0.05, const double numAngles=30);
113
114 virtual ~PPF3DDetector();
115
122 void setSearchParams(const double positionThreshold=-1, const double rotationThreshold=-1, const bool useWeightedClustering=false);
123
131 CV_WRAP void trainModel(const Mat& Model);
132
141 CV_WRAP void match(const Mat& scene, CV_OUT std::vector<Pose3DPtr> &results, const double relativeSceneSampleStep=1.0/5.0, const double relativeSceneDistance=0.03);
142
143 void read(const FileNode& fn);
144 void write(FileStorage& fs) const;
145
146 protected:
147
148 double angle_step, angle_step_radians, distance_step;
149 double sampling_step_relative, angle_step_relative, distance_step_relative;
150 Mat sampled_pc, ppf;
151 int num_ref_points;
152 hashtable_int* hash_table;
153 THash* hash_nodes;
154
155 double position_threshold, rotation_threshold;
156 bool use_weighted_avg;
157
158 int scene_sample_step;
159
160 void clearTrainingModels();
161
162 private:
163 void computePPFFeatures(const Vec3d& p1, const Vec3d& n1,
164 const Vec3d& p2, const Vec3d& n2,
165 Vec4d& f);
166
167 bool matchPose(const Pose3D& sourcePose, const Pose3D& targetPose);
168
169 void clusterPoses(std::vector<Pose3DPtr>& poseList, int numPoses, std::vector<Pose3DPtr> &finalPoses);
170
171 bool trained;
172};
173
175
176} // namespace ppf_match_3d
177
178} // namespace cv
179 #endif
File Storage Node class.
Definition: persistence.hpp:482
XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or readi...
Definition: persistence.hpp:304
n-dimensional dense array class
Definition: mat.hpp:802
Template class for short numerical vectors, a partial case of Matx
Definition: matx.hpp:342
Class, allowing the load and matching 3D models. Typical Use:
Definition: ppf_match_3d.hpp:98
void setSearchParams(const double positionThreshold=-1, const double rotationThreshold=-1, const bool useWeightedClustering=false)
Class, allowing the storage of a pose. The data structure stores both the quaternions and the matrix ...
Definition: pose_3d.hpp:71
struct cv::ppf_match_3d::THash THash
Struct, holding a node in the hashtable
cv
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: t_hash_int.hpp:68
Struct, holding a node in the hashtable
Definition: ppf_match_3d.hpp:80