Ocean
tracking/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_TRACKING_PATTERN_PATTERN_TRACKER_6DOF_H
9 #define META_OCEAN_TRACKING_PATTERN_PATTERN_TRACKER_6DOF_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Tracking
20 {
21 
22 namespace Pattern
23 {
24 
25 /**
26  * This class implements a 6DOF feature tracker for planar patterns.
27  * The class is mainly a wrapper for the PatternTrackerCore6DOF class.
28  * @see PatternTrackerCore6DOF.
29  * @ingroup trackingpattern
30  */
31 class OCEAN_TRACKING_PATTERN_EXPORT PatternTracker6DOF :
32  virtual public VisualTracker,
34 {
35  public:
36 
37  /**
38  * Creates a new feature tracker object.
39  */
40  explicit PatternTracker6DOF(const Options& options = Options());
41 
42  /**
43  * Destructs a feature tracker object.
44  */
45  ~PatternTracker6DOF() override;
46 
47  /**
48  * Adds a new 2D tracking pattern (an image) to the tracker.
49  * The origin of the pattern will be located in the upper left corner of the given frame.<br>
50  * The pattern lies inside the x-z-plane with y-axis as up-vector.
51  * @param frame The frame specifying the tracking pattern, this frame will be converted internally if the pixel format is not FORMAT_Y8, must be valid
52  * @param dimension The dimension of the tracking pattern in the tracker coordinate system, with range (0, infinity)x[0, infinity)
53  * @param worker Optional worker object to distribute the computation
54  * @return The id of the tracking pattern, -1 if the pattern could not be added
55  */
56  unsigned int addPattern(const Frame& frame, const Vector2& dimension, Worker* worker = nullptr);
57 
58  /**
59  * Adds a new 2D tracking pattern (an image) to the tracker.
60  * The origin of the pattern will be located in the upper left corner of the given frame.<br>
61  * The pattern lies inside the x-z-plane with y-axis as up-vector.<br>
62  * This function takes a file in which the pattern is defined, the file can be a simple image or a feature map storing an additional hierarchy of feature points.
63  * @param filename The filename of the file storing the pattern information, must be valid
64  * @param dimension The dimension of the tracking pattern in the tracker coordinate system, with range (0, infinity)x[0, infinity)
65  * @param worker Optional worker object to distribute the computation
66  * @return The id of the tracking pattern, -1 if the pattern could not be added
67  */
68  unsigned int addPattern(const std::string& filename, const Vector2& dimension, Worker* worker = nullptr);
69 
70  /**
71  * Removes a pattern from this tracker.
72  * @param patternId The id of the pattern to be removed
73  * @return True, if succeeded
74  * @see removePatterns().
75  */
76  bool removePattern(const unsigned int patternId);
77 
78  /**
79  * Removes all patterns from this tracker.
80  * @return True, if succeeded
81  * @see removePattern().
82  */
84 
85  /**
86  * Executes the 6DOF tracking for a given frame.
87  * @see VisualTracker::determinePoses().
88  */
89  bool determinePoses(const Frame& frame, const PinholeCamera& pinholeCamera, const bool frameIsUndistorted, TransformationSamples& transformations, const Quaternion& world_R_camera = Quaternion(false), Worker* worker = nullptr) override;
90 
91  protected:
92 
93  /// Intermediate grayscale frame (used to avoid frame buffer re-allocations).
95 };
96 
97 }
98 
99 }
100 
101 }
102 
103 #endif // META_OCEAN_TRACKING_PATTERN_PATTERN_TRACKER_6DOF_H
This class implements Ocean's image class.
Definition: Frame.h:1760
This class implements a 6DOF feature tracker for planar patterns.
Definition: tracking/pattern/PatternTracker6DOF.h:34
unsigned int addPattern(const std::string &filename, const Vector2 &dimension, Worker *worker=nullptr)
Adds a new 2D tracking pattern (an image) to the tracker.
Frame yFrame_
Intermediate grayscale frame (used to avoid frame buffer re-allocations).
Definition: tracking/pattern/PatternTracker6DOF.h:94
bool determinePoses(const Frame &frame, const PinholeCamera &pinholeCamera, const bool frameIsUndistorted, TransformationSamples &transformations, const Quaternion &world_R_camera=Quaternion(false), Worker *worker=nullptr) override
Executes the 6DOF tracking for a given frame.
unsigned int addPattern(const Frame &frame, const Vector2 &dimension, Worker *worker=nullptr)
Adds a new 2D tracking pattern (an image) to the tracker.
PatternTracker6DOF(const Options &options=Options())
Creates a new feature tracker object.
bool removePattern(const unsigned int patternId)
Removes a pattern from this tracker.
~PatternTracker6DOF() override
Destructs a feature tracker object.
bool removePatterns()
Removes all patterns from this tracker.
Set of configurable parameters for the tracker.
Definition: PatternTrackerCore6DOF.h:56
This class implements the core of the 6DOF feature tracker for planar patterns.
Definition: PatternTrackerCore6DOF.h:49
This class implements a base class for all visual tracker objects.
Definition: tracking/VisualTracker.h:45
std::vector< TransformationSample > TransformationSamples
Definition of a vector holding a transformation sample object.
Definition: tracking/VisualTracker.h:98
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
QuaternionT< Scalar > Quaternion
Definition of the Quaternion object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with sin...
Definition: Quaternion.h:33
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15