Ocean
Loading...
Searching...
No Matches
devices/pattern/PatternTracker6DOF.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_DEVICES_PATTERN_TRACKER_6DOF_H
9#define META_OCEAN_DEVICES_PATTERN_TRACKER_6DOF_H
10
13
14#include "ocean/base/Thread.h"
15
20
22
24
25namespace Ocean
26{
27
28namespace Devices
29{
30
31namespace Pattern
32{
33
34/**
35 * This class implements a Pattern feature-based tracker.
36 * @ingroup devicespattern
37 */
38class OCEAN_DEVICES_PATTERN_EXPORT PatternTracker6DOF :
39 virtual public PatternDevice,
40 virtual public Tracker6DOF,
41 virtual public ObjectTracker,
42 virtual public VisualTracker,
43 protected Thread
44{
45 friend class PatternFactory;
46
47 public:
48
49 /**
50 * Adds a new tracking pattern.
51 * For this pattern feature based tracker the pattern must be the url of an image.
52 * @see ObjectTracker::registerObject().
53 */
54 ObjectId registerObject(const std::string& description, const Vector3& dimension) override;
55
56 /**
57 * Returns whether this device is active.
58 * @see Devices::isStarted().
59 */
60 bool isStarted() const override;
61
62 /**
63 * Starts the device.
64 * @see Device::start().
65 */
66 bool start() override;
67
68 /**
69 * Stops the device.
70 * @see Device::stop().
71 */
72 bool stop() override;
73
74 /**
75 * Returns whether a specific object is currently actively tracked by this tracker.
76 * @see Tracker::isObjectTracked().
77 */
78 bool isObjectTracked(const ObjectId& objectId) const override;
79
80 /**
81 * Sets a parameter for this tracker.
82 * Supprted parameters 'noFrameToFrameTracking', 'noDownsamplingOnAndroid'.
83 * @see Device::setParameter().
84 */
85 bool setParameter(const std::string& parameter, const Value& value) override;
86
87 /**
88 * Returns a parameter of this device.
89 * Supprted parameters 'noFrameToFrameTracking', 'noDownsamplingOnAndroid'.
90 * @see Device::parameter().
91 */
92 bool parameter(const std::string& parameter, Value& value) override;
93
94 /**
95 * Returns the name of this tracker.
96 * @return Tracker name
97 */
98 static inline std::string deviceNamePatternTracker6DOF();
99
100 /**
101 * Returns the type of this tracker.
102 * @return Tracker type
103 */
105
106 private:
107
108 /**
109 * Creates a new Pattern feature based 6DOF tracker object.
110 */
112
113 /**
114 * Destructs an Pattern feature based 6DOF tracker object.
115 */
117
118 /**
119 * Ensures that the tracker exists, if the tracker does not yet exist, it will be created.
120 */
122
123 /**
124 * Thread function.
125 * @see Thread::threadRun().
126 */
127 void threadRun() override;
128
129 private:
130
131 /// Frame timestamp.
133
134 /// Holds the 6DOF tracker object.
136
137 /// Set holding all visible marker from the most recent frame.
139
140 /// The 3DOF orientation tracker which is used to support the tracker.
142
143 /// The mapper between internal and external object ids.
145
146 /// True, to skip frame-to-frame tracking.
148
149 /// True, to avoid downsampling the input image on Android devices.
151};
152
154{
155 return std::string("Pattern 6DOF Tracker");
156}
157
162
163}
164
165}
166
167}
168
169#endif // META_OCEAN_DEVICES_PATTERN_TRACKER_6DOF_H
Definition of a class holding the major and minor device type.
Definition devices/Device.h:62
This class implements a helper class to simplify the mapping between internal object ids (of the actu...
Definition Measurement.h:255
ObjectId objectId(const std::string &description) const
Returns the object id for an object description.
std::unordered_set< ObjectId > ObjectIdSet
Definition of an unordered set holding object ids.
Definition Measurement.h:57
uint32_t ObjectId
Definition of an object id.
Definition Measurement.h:47
ObjectTracker(const std::string &name, const DeviceType type)
Creates a new object tracker object.
PatternDevice(const std::string &name, const DeviceType type)
Creates a new device by is name.
bool stop() override
Stops the device.
void ensureTrackerExists()
Ensures that the tracker exists, if the tracker does not yet exist, it will be created.
bool noFrameToFrameTracking_
True, to skip frame-to-frame tracking.
Definition devices/pattern/PatternTracker6DOF.h:147
OrientationTracker3DOFRef orientationTracker3DOF_
The 3DOF orientation tracker which is used to support the tracker.
Definition devices/pattern/PatternTracker6DOF.h:141
bool start() override
Starts the device.
Tracking::VisualTrackerRef visualTracker_
Holds the 6DOF tracker object.
Definition devices/pattern/PatternTracker6DOF.h:135
bool isStarted() const override
Returns whether this device is active.
static DeviceType deviceTypePatternTracker6DOF()
Returns the type of this tracker.
Definition devices/pattern/PatternTracker6DOF.h:158
ObjectIdSet visiblePatterns_
Set holding all visible marker from the most recent frame.
Definition devices/pattern/PatternTracker6DOF.h:138
void threadRun() override
Thread function.
static std::string deviceNamePatternTracker6DOF()
Returns the name of this tracker.
Definition devices/pattern/PatternTracker6DOF.h:153
bool isObjectTracked(const ObjectId &objectId) const override
Returns whether a specific object is currently actively tracked by this tracker.
ObjectMapper< unsigned int > objectIdMapper_
The mapper between internal and external object ids.
Definition devices/pattern/PatternTracker6DOF.h:144
~PatternTracker6DOF() override
Destructs an Pattern feature based 6DOF tracker object.
bool noDownsamplingOnAndroid_
True, to avoid downsampling the input image on Android devices.
Definition devices/pattern/PatternTracker6DOF.h:150
Timestamp frameTimestamp_
Frame timestamp.
Definition devices/pattern/PatternTracker6DOF.h:132
friend class PatternFactory
Definition devices/pattern/PatternTracker6DOF.h:45
bool setParameter(const std::string &parameter, const Value &value) override
Sets a parameter for this tracker.
bool parameter(const std::string &parameter, Value &value) override
Returns a parameter of this device.
ObjectId registerObject(const std::string &description, const Vector3 &dimension) override
Adds a new tracking pattern.
PatternTracker6DOF()
Creates a new Pattern feature based 6DOF tracker object.
Tracker6DOF(const std::string &name)
Creates a new 6DOF tracker object.
static DeviceType deviceTypeTracker6DOF()
Definition of this device type.
Definition Tracker6DOF.h:106
@ TRACKER_VISUAL
Tracker using a visual input for their measurements.
Definition devices/Tracker.h:64
@ TRACKER_OBJECT
Tracker allowing to register tracking objects at runtime.
Definition devices/Tracker.h:66
VisualTracker(const std::string &name, const DeviceType type)
Creates a new visual tracker object.
Thread(const std::string &name=std::string())
Creates a new thread object.
This class implements a timestamp.
Definition Timestamp.h:64
This class implements a type independent value.
Definition Value.h:23
SmartObjectRef< OrientationTracker3DOF, Device > OrientationTracker3DOFRef
Definition of a 3DOF orientation tracker reference object.
Definition OrientationTracker3DOF.h:32
VectorT3< Scalar > Vector3
Definition of a 3D vector.
Definition Vector3.h:29
ObjectRef< VisualTracker > VisualTrackerRef
Definition of an object reference covering a visual tracker object.
Definition tracking/VisualTracker.h:38
Namespace of the Devices Pattern library.
Definition devices/pattern/jni/JNI.h:22
Namespace of the Devices library.
Definition AccelerationSensor3DOF.h:24
The namespace covering the entire Ocean framework.
Definition Accessor.h:15