8 #ifndef META_OCEAN_TRACKING_OFFLINE_OFFLINE_TRACKER_H
9 #define META_OCEAN_TRACKING_OFFLINE_OFFLINE_TRACKER_H
134 inline Scalar startProgress()
const;
140 inline Scalar stopProgress()
const;
195 inline void modify(
const Scalar startProgress,
const Scalar stopProgress);
201 inline void modify(
const Scalar stopProgress);
255 virtual bool stop(
const unsigned int timeout = 0u);
262 inline unsigned int id()
const;
307 inline void removeEventCallback(
const EventCallback& callback);
413 unsigned int id_ = 0u;
416 bool finished_ =
true;
419 bool shouldStop_ =
false;
444 startProgress_(startProgress),
445 stopProgress_(stopProgress)
453 return startProgress_;
458 return stopProgress_;
467 EventStackLayer(scopedLayer.startProgress_, scopedLayer.stopProgress_),
468 owner_(scopedLayer.owner_)
470 scopedLayer.owner_ =
nullptr;
489 owner_->popProgressEventStackLayer(*
this);
496 ocean_assert(owner_);
500 ocean_assert(startProgress <= stopProgress);
501 ocean_assert(startProgress >=
Scalar(0) && stopProgress <=
Scalar(1));
503 owner_->popProgressEventStackLayer(*
this);
505 startProgress_ = startProgress;
506 stopProgress_ = stopProgress;
508 owner_->pushProgressEventStackLayer(*
this);
514 modify(stopProgress_, stopProgress);
518 if (
this != &scopedLayer)
522 owner_ = scopedLayer.owner_;
523 scopedLayer.owner_ =
nullptr;
This class implements a container for callback functions.
Definition: Callback.h:3456
void addCallback(const T &callback)
Adds a new callback object.
Definition: Callback.h:4304
void removeCallback(const T &callback)
Removes a callback object.
Definition: Callback.h:4329
This class implements a recursive lock object.
Definition: Lock.h:31
This template class implements a object reference with an internal reference counter.
Definition: base/ObjectRef.h:58
std::ptrdiff_t Index
Definition of an element index.
Definition: ShiftVector.h:38
This class implements a thread.
Definition: Thread.h:115
This class encapsulates the tracking pose data.
Definition: OfflinePose.h:41
This class implements one layer in a progress event stack allowing to define the start and stop progr...
Definition: OfflineTracker.h:120
bool operator==(const EventStackLayer &layer) const
Returns whether two objects have identical start and stop values.
Definition: OfflineTracker.h:461
Scalar startProgress_
The relative start progress value of this object.
Definition: OfflineTracker.h:152
Scalar stopProgress_
the relative stop progress value of this object.
Definition: OfflineTracker.h:155
Scalar stopProgress() const
Returns the relative stop progress value of this object.
Definition: OfflineTracker.h:456
EventStackLayer(const Scalar startProgress, const Scalar stopProgress)
Creates a new layer object.
Definition: OfflineTracker.h:443
Scalar startProgress() const
Returns the relative start progress value of this object.
Definition: OfflineTracker.h:451
This class implements an event stack layer object that pushes the relative progress parameters on the...
Definition: OfflineTracker.h:163
ScopedEventStackLayer & operator=(ScopedEventStackLayer &&scopedLayer) noexcept
Move operator.
Definition: OfflineTracker.h:516
OfflineTracker * owner_
The owner of the stack that is associated with this object.
Definition: OfflineTracker.h:226
ScopedEventStackLayer & operator=(const ScopedEventStackLayer &)=delete
Assign operator.
~ScopedEventStackLayer()
Destructs the scoped layer object and pops the relative progress values from the stack.
Definition: OfflineTracker.h:480
ScopedEventStackLayer(const ScopedEventStackLayer &)=delete
Copy constructor.
void modify(const Scalar startProgress, const Scalar stopProgress)
Modifies the relative start and stop progress values of this object.
Definition: OfflineTracker.h:494
ScopedEventStackLayer(ScopedEventStackLayer &&scopedLayer) noexcept
Move constructor.
Definition: OfflineTracker.h:466
void release()
Releases this scoped layer object explicitly before the scope ends.
Definition: OfflineTracker.h:485
This class is the base class for all offline tracker objects.
Definition: OfflineTracker.h:45
Callback< void, const TrackerEvent & > EventCallback
Definition of a component event callback function.
Definition: OfflineTracker.h:105
void updateTrackerProgress(const Scalar localProgress)
Updates the tracker process progress value of this tracker.
void removeIrregularPoses(const Scalar factor=Scalar(5))
Removes irregular poses at the boundary between valid and invalid poses.
static bool isPlausibleCamera(const PinholeCamera &pinholeCamera, const CameraModel model)
Checks whether the camera parameters of a given camera profiles matches to the specified camera model...
unsigned int id() const
Returns the unique id of this tracker object.
Definition: OfflineTracker.h:529
OfflinePoses offlinePoses_
Offline poses of this tracker.
Definition: OfflineTracker.h:422
std::vector< EventStackLayer > EventStack
Definition of a vector holding EventStackLayer objects which actually is used to implement a stack of...
Definition: OfflineTracker.h:232
void removeEventCallback(const EventCallback &callback)
Removes a state event callback function.
Definition: OfflineTracker.h:539
virtual ~OfflineTracker()
Frees the offline tracker object.
virtual bool succeeded() const =0
Returns whether the offline tracker has finished and succeeded since the last start or has not been s...
static void extrapolateLeftPoses(const OfflinePoses::Index invalidIndex, const unsigned int number, const unsigned int base, OfflinePoses &offlinePoses)
Interpolates some poses to the left of a gap with invalid poses.
virtual bool start()
Starts the offline tracker.
ConcurrentCallbacks< EventCallback > EventCallbacks
Definition of a vector holding event callback functions.
Definition: OfflineTracker.h:237
Lock lock_
Tracker lock object.
Definition: OfflineTracker.h:428
void pushProgressEventStackLayer(const EventStackLayer &layer)
Pushes a new progress event stack layer on the stack of this tracker.
virtual OfflinePose pose(const unsigned int index) const
Returns one pose of this tracker.
unsigned int id_
The unique id that identifies this tracker.
Definition: OfflineTracker.h:413
static void extrapolateCenterPoses(const OfflinePoses::Index invalidIndex, const unsigned int number, const unsigned int base, OfflinePoses &offlinePoses)
Interpolates some poses to the left or to the right of a gap with invalid poses.
TrackingQuality
Definition of individual tracking qualities.
Definition: OfflineTracker.h:54
@ TQ_HIGH
A high tracking quality with low performance.
Definition: OfflineTracker.h:60
@ TQ_COARSE
Coverage with coarse grid.
Definition: OfflineTracker.h:68
@ TQ_ULTRA
A very high tracking quality with very low performance.
Definition: OfflineTracker.h:62
@ TQ_MODERATE
A moderate tracking quality with moderate performance.
Definition: OfflineTracker.h:58
@ TQ_INSANE
An insane tracking quality with very low performance.
Definition: OfflineTracker.h:64
@ TQ_AUTOMATIC
Automatic tracking quality.
Definition: OfflineTracker.h:66
@ TQ_LOW
A low tracking quality with high performance.
Definition: OfflineTracker.h:56
virtual bool running() const
Returns whether the tracker has been started (and is currently tracking).
static void extrapolateRightPoses(const OfflinePoses::Index invalidIndex, const unsigned int number, const unsigned int base, OfflinePoses &offlinePoses)
Interpolates some poses to the right of a gap with invalid poses.
virtual OfflinePoses poses() const
Returns the currently determined poses of this tracker.
static Lock & idCounterLock()
Returns a reference to the lock for the tracker id counter.
static void extrapolateSinglePose(const OfflinePoses::Index invalidIndex, OfflinePoses &offlinePoses)
Interpolates the pose of a single invalid pose which is enclosed by two valid poses.
static unsigned int idCounter_
The tracker id counter.
Definition: OfflineTracker.h:440
void extrapolatePoses(const unsigned int number, const unsigned int base)
Extrapolates poses at the boundary between valid and invalid poses.
void addEventCallback(const EventCallback &callback)
Adds a state event callback function.
Definition: OfflineTracker.h:534
EventStack eventStack_
The stack with progress event layers allowing for a convenient process progress event handling.
Definition: OfflineTracker.h:431
CameraModel
Definition of individual camera models.
Definition: OfflineTracker.h:90
@ CM_LOW_QUALITY
Low quality camera, equivalent to a state-of-the-art webcams.
Definition: OfflineTracker.h:94
@ CM_MEDIUM_QUALITY
Medium camera model, equivalent to an amateur camera.
Definition: OfflineTracker.h:96
@ CM_INVALID
Invalid camera model parameter.
Definition: OfflineTracker.h:92
void updatePoses(const OfflinePoses &poses)
Updates all poses of this tracker and invokes the corresponding state event(s).
virtual bool stop(const unsigned int timeout=0u)
Stops the offline tracker.
virtual bool finished() const
Returns whether the offline tracker has finished since the last start or has not been started yet.
EventCallbacks eventCallbacks_
State event callback functions.
Definition: OfflineTracker.h:425
Lock eventStackLock_
The lock for the progress event layer stack.
Definition: OfflineTracker.h:434
OfflineTracker()
Creates a new offline tracker object.
void popProgressEventStackLayer(const EventStackLayer &layer)
Pops a progress event stack layer from the stack of this tracker.
AbstractMotionType
Definition of individual abstract camera motion types.
Definition: OfflineTracker.h:77
@ AMT_PURE_ROTATIONAL
A pure rotational camera motion.
Definition: OfflineTracker.h:81
@ AMT_UNKNOWN
An unknown abstract camera motion.
Definition: OfflineTracker.h:79
friend class EventStackLayer
Definition: OfflineTracker.h:46
float Scalar
Definition of a scalar type.
Definition: Math.h:128
constexpr VertexIndex invalidIndex
Definition of an invalid vertex index.
Definition: rendering/Rendering.h:77
ObjectRef< OfflineTracker > OfflineTrackerRef
Definition of an object reference holding an offline tracker object.
Definition: OfflineTracker.h:31
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15