blob: c3b417a701765e8a26eb5ac325609dc3e77a1f72 (
plain)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
#include "ftnoir_tracker_pt.h"
#include "module.hpp"
#include "camera.h"
#include "camera_kinect_ir.h"
#include "compat/camera-names.hpp"
#include "frame.hpp"
#include "point_extractor.h"
#include "ftnoir_tracker_pt_dialog.h"
#include "pt-api.hpp"
#include <memory>
static const QString module_name = "tracker-pt";
#ifdef __clang__
# pragma clang diagnostic ignored "-Wweak-vtables"
#endif
namespace pt_module {
///
/// Traits for OpenCV VideoCapture camera
///
struct pt_module_traits final : pt_runtime_traits
{
pointer<pt_camera> make_camera() const override
{
return pointer<pt_camera>(new Camera(module_name));
}
pointer<pt_point_extractor> make_point_extractor() const override
{
return pointer<pt_point_extractor>(new PointExtractor(module_name));
}
QString get_module_name() const override
{
return module_name;
}
pointer<pt_frame> make_frame() const override
{
return pointer<pt_frame>(new Frame);
}
pointer<pt_preview> make_preview(int w, int h) const override
{
return pointer<pt_preview>(new Preview(w, h));
}
};
#if __has_include(<Kinect.h>)
///
/// Traits for Kinect V2 IR Sensor
///
struct KinectIrTraits final : pt_runtime_traits
{
pointer<pt_camera> make_camera() const override
{
return pointer<pt_camera>(new CameraKinectIr(module_name));
}
pointer<pt_point_extractor> make_point_extractor() const override
{
return pointer<pt_point_extractor>(new PointExtractor(module_name));
}
QString get_module_name() const override
{
return module_name;
}
pointer<pt_frame> make_frame() const override
{
return pointer<pt_frame>(new Frame);
}
pointer<pt_preview> make_preview(int w, int h) const override
{
return pointer<pt_preview>(new Preview(w, h));
}
};
#endif
struct tracker_pt : Tracker_PT
{
tracker_pt() : Tracker_PT(module_name)
{
}
pointer<pt_runtime_traits> create_traits() override
{
#if __has_include(<Kinect.h>)
// Create Kinect traits according to settings
if (s.camera_name().compare(KKinectIRSensor) == 0)
{
// Use Kinect IR trait
return pointer<pt_runtime_traits>(new KinectIrTraits);
}
#endif
return pointer<pt_runtime_traits>(new pt_module_traits);
}
};
struct dialog_pt : TrackerDialog_PT
{
dialog_pt();
};
dialog_pt::dialog_pt() : TrackerDialog_PT(module_name) {}
QString metadata_pt::name() { return tr("PointTracker 1.1"); }
QIcon metadata_pt::icon() { return QIcon(":/Resources/Logo_IR.png"); }
}
// ns pt_module
using namespace pt_module;
OPENTRACK_DECLARE_TRACKER(tracker_pt, dialog_pt, metadata_pt)
|