forked from raulmur/ORB_SLAM2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWrapper.h
110 lines (86 loc) · 2.1 KB
/
Wrapper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
* Wrapper.h
*
* Created on: 29th Jan 2017
* Author: Samuel Dudley
*/
#ifndef WRAPPER_H
#define WRAPPER_H
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<fstream>
#include<vector>
#include<chrono>
#include<iomanip>
#include<opencv2/core.hpp>
#include<Converter.h>
#include<aruco.h>
#include<System.h>
#include<boost/python.hpp>
#include<xiApiPlusOcv.h>
struct MarkerData
{
MarkerData() :
name(), dict(), id(), ssize(-1)
{
}
string name;
string dict;
int id;
float ssize;
void read(const cv::FileNode& node) //Read serialization for this class
{
name = (string)node["name"];
dict = (string)node["dictionary"];
id = (int)node["id"];
ssize = (float)node["size"];
}
};
static void read(const cv::FileNode& node, MarkerData& x, const MarkerData& default_value = MarkerData()){
if(node.empty())
x = default_value;
else
x.read(node);
}
class Wrapper
{
public:
Wrapper(std::string strVocFile, std::string strConfigFile); // wrapper constructor
void initialize();
void shutdown();
void configure(std::string strConfigFile);
void track();
int getStatus();
void reset();
void getCurrentFrame();
bool getTrackMarkers();
void setTrackMarkers(bool shouldTrackMarkers);
bool getIsInitialized();
public:
std::string msg;
std::string vocabularyFilePath;
std::string configurationFilePath;
bool isInitialized;
bool trackMarkers;
xiAPIplusCameraOcv cam;
cv::Mat src;
cv::Mat im;
cv::Mat currentFrame; //im with tracking visualization drawn on it
cv::FileStorage fsConfiguration;
const double tframe = 0.1;
cv::Mat autopilotPoseCurrent = cv::Mat::eye(4,4,CV_32F);
cv::Mat cameraMatrix;
cv::Mat distorsionCoeff;
aruco::CameraParameters cameraParameters;
aruco::MarkerDetector markerDetector;
std::map<uint32_t, aruco::MarkerPoseTracker> markerTracker; // use a map so that for each id, we use a different pose tracker
vector<aruco::Marker> markers;
std::map<uint32_t, MarkerData> markerConfigurations;
private:
bool initialized();
private:
ORB_SLAM2::System* SLAM;
};
#endif // WRAPPER_H