8 #ifndef META_OCEAN_DEVICES_ARCORE_AR_SESSION_MANAGER_H
9 #define META_OCEAN_DEVICES_ARCORE_AR_SESSION_MANAGER_H
25 #include <arcore_c_api.h>
64 using TrackerMap = std::unordered_map<ACDevice*, unsigned int>;
69 using PlaneIdMap = std::unordered_map<ArPlane*, Index32>;
167 using SessionMap = std::unordered_map<std::string, SharedSession>;
172 using TrackerMap = std::unordered_map<ACDevice*, std::string>;
180 inline bool isARCoreAvailable()
const;
280 bool isARCoreAvailable_ =
false;
This class implements a device for the ARCore library.
Definition: ACDevice.h:36
TrackerCapabilities
Definition of individual capabilities.
Definition: ACDevice.h:46
@ TC_INVALID
An invalid capability.
Definition: ACDevice.h:48
This class implements a device factory for the ARCore tracking library.
Definition: ACFactory.h:29
This class implements an AR session, one session is associated with a specific camera.
Definition: ARSessionManager.h:58
size_t registeredTrackers()
Returns the number of registered trackers.
bool start(ACDevice *tracker)
Starts the session for a given tracker.
ScopedARSession arSession_
The AR Session object.
Definition: ARSessionManager.h:141
void update(unsigned int textureId)
Updates the tracker with the most recent tracking results from ARCore.
std::unordered_map< ArPlane *, Index32 > PlaneIdMap
Definition of an unordered map mapping ArPlane objects to ids.
Definition: ARSessionManager.h:69
Media::FrameMediumRef frameMedium_
The frame medium object used as input for the tracker.
Definition: ARSessionManager.h:144
bool registerTracker(ACDevice *tracker)
Registers a new tracker with this session.
bool pause(ACDevice *tracker)
Pauses the session for a given tracker.
bool stop(ACDevice *tracker)
Stops the session for a given tracker.
bool extractPlanes(ArSession *arSession, ArFrame *arFrame, SceneTracker6DOF::SceneElementPlanes::Planes &planes)
Extracts all planes from an ArFrame.
std::unordered_map< ACDevice *, unsigned int > TrackerMap
Definition of an unordered map mapping trackers to running states.
Definition: ARSessionManager.h:64
bool unregisterTracker(ACDevice *tracker)
Unregisters a tracker with this session.
PlaneIdMap planeIdMap_
The map mapping planes to ids.
Definition: ARSessionManager.h:156
Session(const Media::FrameMediumRef &frameMedium)
Creates a new session for a given frame medium.
TrackerMap trackerMap_
The map mapping tracker to running states.
Definition: ARSessionManager.h:150
This class implements a wrapper around the actual ARCore tracker which may be used by several devices...
Definition: ARSessionManager.h:41
bool registerTracker(ACDevice *tracker, const Media::FrameMediumRef &frameMedium)
Registers a new tracker.
std::shared_ptr< Session > SharedSession
Definition of a shared pointer holding a session.
Definition: ARSessionManager.h:162
static Frame extractImage(ArSession *arSession, ArFrame *arFrame, Media::LiveVideo::ControlMode &exposureMode, double &exposureDuration, Media::LiveVideo::ControlMode &isoMode, float &iso, Media::LiveVideo::ControlMode &focusMode, float &focusValue)
Extracts the image from an ArFrame.
bool start(ACDevice *tracker)
Starts the session for a given tracker.
std::unordered_map< std::string, SharedSession > SessionMap
Definition of an unordered map mapping medium urls to sessions.
Definition: ARSessionManager.h:167
bool isARCoreAvailable_
True, if ARCore is available on the device.
Definition: ARSessionManager.h:280
TrackerMap trackerMap_
The map mapping trackers to medium urls.
Definition: ARSessionManager.h:286
static bool extractPointCloud(ArSession *arSession, ArFrame *arFrame, Vectors3 &objectPoints, Indices64 &objectPointIds)
Extracts the point cloud for an ArFrame.
static Frame extractDepth(const ArSession *arSession, const ArFrame *arFrame)
Extracts the depth from an ArFrame.
bool pause(ACDevice *tracker)
Pauses the session for a given tracker.
Lock lock_
The manager's lock.
Definition: ARSessionManager.h:289
bool isARCoreAvailable() const
Returns whether ARCore is available on the device.
Definition: ARSessionManager.h:292
void update(unsigned int textureId)
Updates the tracker with the most recent tracking results from ARCore.
std::unordered_map< ACDevice *, std::string > TrackerMap
Definition of an unordered map mapping trackers to medium urls.
Definition: ARSessionManager.h:172
bool unregisterTracker(ACDevice *tracker)
Unregisteres a given tracker.
ARSessionManager()
Creates a new manager.
bool stop(ACDevice *tracker)
Stops the session for a given tracker.
SessionMap sessionMap_
The map mapping medium urls to sessions.
Definition: ARSessionManager.h:283
static bool extractPose(ArSession *arSession, ArFrame *arFrame, HomogenousMatrixF4 &world_T_device, SharedAnyCamera &anyCamera)
Extracts the camera pose and camera profile from an ArFrame.
std::vector< Plane > Planes
Definition of a vector holding planes.
Definition: SceneTracker6DOF.h:320
This class implements Ocean's image class.
Definition: Frame.h:1792
This class implements a 4x4 homogeneous transformation matrix using floating point values with the pr...
Definition: HomogenousMatrix4.h:110
This class implements a recursive lock object.
Definition: Lock.h:31
static constexpr T minValue()
Returns the min scalar value.
Definition: Numeric.h:3250
This class implements a scoped lock object for recursive lock objects.
Definition: Lock.h:135
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
std::vector< Index64 > Indices64
Definition of a vector holding 64 bit index values.
Definition: Base.h:108
std::shared_ptr< AnyCamera > SharedAnyCamera
Definition of a shared pointer holding an AnyCamera object with Scalar precision.
Definition: AnyCamera.h:60
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition: Vector3.h:65
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15