Ocean
AKFaceTracker6DOF.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_ARKIT_AK_FACE_TRACKER_6_DOF_H
9 #define META_OCEAN_DEVICES_ARKIT_AK_FACE_TRACKER_6_DOF_H
10 
13 
16 
17 namespace Ocean
18 {
19 
20 namespace Devices
21 {
22 
23 namespace ARKit
24 {
25 
26 /**
27  * This class implements the 6DOF face tracker providing only the head pose.
28  * ARKit's face tracker can combine SLAM/World tracker. Face tracking is always executed on the user-facing camera while the back-facing camera is used for SLAM/World tracking.<br>
29  * Therefore, the input medium should always be the back-facing camera instead of the user-facing camera.
30  * @ingroup devicesarkit
31  */
32 class OCEAN_DEVICES_ARKIT_EXPORT AKFaceTracker6DOF :
33  virtual public AKDevice,
34  virtual public Tracker6DOF,
35  virtual public VisualTracker
36 {
37  friend class AKFactory;
38 
39  public:
40 
41  /**
42  * Starts the device.
43  * @see Device::start().
44  */
45  bool start() override;
46 
47  /**
48  * Pauses the device.
49  * @see Device::pause().
50  */
51  bool pause() override;
52 
53  /**
54  * Stops the device.
55  * @see Device::stop().
56  */
57  bool stop() override;
58 
59  /**
60  * Sets the multi-view visual input of this tracker.
61  * @see VisualTracker::setInput().
62  */
63  void setInput(Media::FrameMediumRefs&& frameMediums) override;
64 
65  /**
66  * Returns whether a specific object is currently actively tracked by this tracker.
67  * @see Tracker::isObjectTracked().
68  */
69  bool isObjectTracked(const ObjectId& objectId) const override;
70 
71  /**
72  * Event function for a new 6DOF pose.
73  * @param world_T_camera The transformation between camera and world, invalid if unknown/lost
74  * @param timestamp The timestamp of the new transformation
75  * @param arFrame The current ARFRame object containing additional data for the sample, must be valid
76  */
77  API_AVAILABLE(ios(13.0))
78  void onNewSample(const HomogenousMatrix4& world_T_camera, const Timestamp& timestamp, ARFrame* arFrame);
79 
80  /**
81  * Returns the name of this tracker.
82  * @return The trackers's name
83  */
84  static inline std::string deviceNameAKFaceTracker6DOF();
85 
86  /**
87  * Returns the device type of this tracker.
88  * @return The tracker's device type
89  */
90  static inline DeviceType deviceTypeAKFaceTracker6DOF();
91 
92  protected:
93 
94  /**
95  * Creates a new 6DOF face tracker.
96  */
97  explicit AKFaceTracker6DOF();
98 
99  /**
100  * Destructs this 6DOF tracker.
101  */
102  ~AKFaceTracker6DOF() override;
103 
104  protected:
105 
106  /// The unique id for the face object.
107  ObjectId faceObjectId_ = invalidObjectId();
108 
109  /// True, if the tracker has been started.
110  bool isStarted_ = false;
111 
112  /// True, if the face object is currently tracked.
113  bool faceIsTracked_ = false;
114 };
115 
116 inline std::string AKFaceTracker6DOF::deviceNameAKFaceTracker6DOF()
117 {
118  return std::string("ARKit 6DOF Face Tracker");
119 }
120 
122 {
123  return DeviceType(deviceTypeTracker6DOF(), TRACKER_VISUAL);
124 }
125 
126 }
127 
128 }
129 
130 }
131 
132 #endif // META_OCEAN_DEVICES_ARKIT_AK_FACE_TRACKER_6_DOF_H
This class implements a device for the ARKit library.
Definition: AKDevice.h:48
This class implements the 6DOF face tracker providing only the head pose.
Definition: AKFaceTracker6DOF.h:36
API_AVAILABLE(ios(13.0)) void onNewSample(const HomogenousMatrix4 &world_T_camera
Event function for a new 6DOF pose.
static DeviceType deviceTypeAKFaceTracker6DOF()
Returns the device type of this tracker.
Definition: AKFaceTracker6DOF.h:121
void setInput(Media::FrameMediumRefs &&frameMediums) override
Sets the multi-view visual input of this tracker.
bool stop() override
Stops the device.
bool pause() override
Pauses the device.
bool isObjectTracked(const ObjectId &objectId) const override
Returns whether a specific object is currently actively tracked by this tracker.
bool start() override
Starts the device.
This class implements a device factory for the ARKit tracking library.
Definition: AKFactory.h:32
Definition of a class holding the major and minor device type.
Definition: devices/Device.h:62
unsigned int ObjectId
Definition of an object id.
Definition: Measurement.h:46
This class implements the base for all 6DOF trackers.
Definition: Tracker6DOF.h:39
This class is the base class for all tracker using visual input to create the tracking results.
Definition: devices/VisualTracker.h:41
This class implements a timestamp.
Definition: Timestamp.h:36
std::vector< FrameMediumRef > FrameMediumRefs
Definition of a vector holding frame medium reference objects.
Definition: FrameMedium.h:46
const ObjectId invalidObjectId
Definition of an invalid object id.
Definition: rendering/Rendering.h:65
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15