Ocean
devices/VisualTracker.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_VISUAL_TRACKER_H
9 #define META_OCEAN_DEVICES_VISUAL_TRACKER_H
10 
11 #include "ocean/devices/Devices.h"
13 #include "ocean/devices/Tracker.h"
14 
16 #include "ocean/media/MediumRef.h"
17 
18 #include "ocean/math/Vector3.h"
19 
20 namespace Ocean
21 {
22 
23 namespace Devices
24 {
25 
26 // Forward declaration.
27 class VisualTracker;
28 
29 /**
30  * Definition of a smart object reference for a visual tracker.
31  * @see VisualTracker.
32  * @ingroup devices
33  */
35 
36 /**
37  * This class is the base class for all tracker using visual input to create the tracking results.
38  * @ingroup devices
39  */
40 class OCEAN_DEVICES_EXPORT VisualTracker : virtual public Tracker
41 {
42  public:
43 
44  /**
45  * Returns the medium objects of this tracker used as visual input.
46  * The majority of tracker will be based on mono camera inputs, while some tracker may use stereo or multi-view vision.
47  * @return Visual input media object
48  */
49  inline Media::FrameMediumRefs input() const;
50 
51  /**
52  * Sets the mono visual input of this tracker.
53  * @param frameMedium The visual input medium object to set
54  */
55  inline void setInput(const Media::FrameMediumRef& frameMedium);
56 
57  /**
58  * Sets the multi-view visual input of this tracker.
59  * @param frameMediums The visual input medium objects to set
60  */
61  virtual void setInput(Media::FrameMediumRefs&& frameMediums);
62 
63  protected:
64 
65  /**
66  * Creates a new visual tracker object.
67  * @param name The name of the tracker
68  * @param type Major and minor device type of the device
69  */
70  VisualTracker(const std::string& name, const DeviceType type);
71 
72  /**
73  * Destructs a visual tracker object.
74  */
75  ~VisualTracker() override;
76 
77  protected:
78 
79  /// Visual input media objects.
81 };
82 
84 {
85  const ScopedLock scopedLock(deviceLock);
86 
87  return frameMediums_;
88 }
89 
90 inline void VisualTracker::setInput(const Media::FrameMediumRef& frameMedium)
91 {
92  setInput(Media::FrameMediumRefs(1, frameMedium));
93 }
94 
95 }
96 
97 }
98 
99 #endif // META_OCEAN_DEVICES_VISUAL_TRACKER_H
Definition of a class holding the major and minor device type.
Definition: devices/Device.h:62
Lock deviceLock
Device lock.
Definition: devices/Device.h:284
This class implements a smart device reference.
Definition: DeviceRef.h:36
This class implements the base class for all tracker devices.
Definition: devices/Tracker.h:39
This class is the base class for all tracker using visual input to create the tracking results.
Definition: devices/VisualTracker.h:41
virtual void setInput(Media::FrameMediumRefs &&frameMediums)
Sets the multi-view visual input of this tracker.
Media::FrameMediumRefs frameMediums_
Visual input media objects.
Definition: devices/VisualTracker.h:80
Media::FrameMediumRefs input() const
Returns the medium objects of this tracker used as visual input.
Definition: devices/VisualTracker.h:83
VisualTracker(const std::string &name, const DeviceType type)
Creates a new visual tracker object.
void setInput(const Media::FrameMediumRef &frameMedium)
Sets the mono visual input of this tracker.
Definition: devices/VisualTracker.h:90
~VisualTracker() override
Destructs a visual tracker object.
This class implements a scoped lock object for recursive lock objects.
Definition: Lock.h:135
SmartDeviceRef< VisualTracker > VisualTrackerRef
Definition of a smart object reference for a visual tracker.
Definition: devices/VisualTracker.h:27
std::vector< FrameMediumRef > FrameMediumRefs
Definition of a vector holding frame medium reference objects.
Definition: FrameMedium.h:46
SmartMediumRef< FrameMedium > FrameMediumRef
Definition of a smart medium reference holding a frame medium object.
Definition: FrameMedium.h:32
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15