OpenCV 4.5.3(日本語機械翻訳)
pose_graph.hpp
1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html
4
5 #ifndef OPENCV_RGBD_POSE_GRAPH_HPP
6 #define OPENCV_RGBD_POSE_GRAPH_HPP
7
8 #include "opencv2/core/affine.hpp"
9 #include "opencv2/core/quaternion.hpp"
10
11 namespace cv
12{
13 namespace kinfu
14{
15 namespace detail
16{
17
18 // ATTENTION! This class is used internally in Large KinFu.
19 // It has been pushed to publicly available headers for tests only.
20 // Source compatibility of this API is not guaranteed in the future.
21
22 // This class provides tools to solve so-called pose graph problem often arisen in SLAM problems
23 // The pose graph format, cost function and optimization techniques
24 // repeat the ones used in Ceres 3D Pose Graph Optimization:
25 // http://ceres-solver.org/nnls_tutorial.html#other-examples, pose_graph_3d.cc bullet
26 class CV_EXPORTS_W PoseGraph
27{
28 public:
29 static Ptr<PoseGraph> create();
30 virtual ~PoseGraph();
31
32 // Node may have any id >= 0
33 virtual void addNode(size_t _nodeId, const Affine3d& _pose, bool fixed) = 0;
34 virtual bool isNodeExist(size_t nodeId) const = 0;
35 virtual bool setNodeFixed(size_t nodeId, bool fixed) = 0;
36 virtual bool isNodeFixed(size_t nodeId) const = 0;
37 virtual Affine3d getNodePose(size_t nodeId) const = 0;
38 virtual std::vector<size_t> getNodesIds() const = 0;
39 virtual size_t getNumNodes() const = 0;
40
41 // Edges have consequent indices starting from 0
42 virtual void addEdge(size_t _sourceNodeId, size_t _targetNodeId, const Affine3f& _transformation,
43 const Matx66f& _information = Matx66f::eye()) = 0;
44 virtual size_t getEdgeStart(size_t i) const = 0;
45 virtual size_t getEdgeEnd(size_t i) const = 0;
46 virtual size_t getNumEdges() const = 0;
47
48 // checks if graph is connected and each edge connects exactly 2 nodes
49 virtual bool isValid() const = 0;
50
51 // Termination criteria are max number of iterations and min relative energy change to current energy
52 // Returns number of iterations elapsed or -1 if max number of iterations was reached or failed to optimize
53 virtual int optimize(const cv::TermCriteria& tc = cv::TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 100, 1e-6)) = 0;
54
55 // calculate cost function based on current nodes parameters
56 virtual double calcEnergy() const = 0;
57};
58
59} // namespace detail
60} // namespace kinfu
61} // namespace cv
62 #endif /* ifndef OPENCV_RGBD_POSE_GRAPH_HPP */
Template class for small matrices whose type and size are known at compilation time
Definition: matx.hpp:100
The class defining termination criteria for iterative algorithms.
Definition: core/types.hpp:853
@ EPS
the desired accuracy or change in parameters at which the iterative algorithm stops
Definition: core/types.hpp:862
@ COUNT
the maximum number of iterations or elements to compute
Definition: core/types.hpp:860
Definition: pose_graph.hpp:27
cv
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: cvstd_wrapper.hpp:74