Ocean
Ocean::Tracking::Offline::OfflineTracker Class Referenceabstract

This class is the base class for all offline tracker objects. More...

Inheritance diagram for Ocean::Tracking::Offline::OfflineTracker:

Data Structures

class  EventStackLayer
 This class implements one layer in a progress event stack allowing to define the start and stop progress value. More...
 
class  ScopedEventStackLayer
 This class implements an event stack layer object that pushes the relative progress parameters on the stack during creation and pops the layer if the object is disposed. More...
 

Public Types

enum  TrackingQuality {
  TQ_LOW , TQ_MODERATE , TQ_HIGH , TQ_ULTRA ,
  TQ_INSANE , TQ_AUTOMATIC , TQ_COARSE , TQ_FINE
}
 Definition of individual tracking qualities. More...
 
enum  AbstractMotionType { AMT_UNKNOWN , AMT_PURE_ROTATIONAL , AMT_COMPLEX }
 Definition of individual abstract camera motion types. More...
 
enum  CameraModel { CM_INVALID , CM_LOW_QUALITY , CM_MEDIUM_QUALITY , CM_HIGH_QUALITY }
 Definition of individual camera models. More...
 
typedef Callback< void, const TrackerEvent & > EventCallback
 Definition of a component event callback function. More...
 

Public Member Functions

virtual ~OfflineTracker ()
 Frees the offline tracker object. More...
 
virtual bool start ()
 Starts the offline tracker. More...
 
virtual bool stop (const unsigned int timeout=0u)
 Stops the offline tracker. More...
 
unsigned int id () const
 Returns the unique id of this tracker object. More...
 
virtual bool running () const
 Returns whether the tracker has been started (and is currently tracking). More...
 
virtual bool finished () const
 Returns whether the offline tracker has finished since the last start or has not been started yet. More...
 
virtual bool succeeded () const =0
 Returns whether the offline tracker has finished and succeeded since the last start or has not been started yet. More...
 
virtual OfflinePoses poses () const
 Returns the currently determined poses of this tracker. More...
 
virtual OfflinePose pose (const unsigned int index) const
 Returns one pose of this tracker. More...
 
void addEventCallback (const EventCallback &callback)
 Adds a state event callback function. More...
 
void removeEventCallback (const EventCallback &callback)
 Removes a state event callback function. More...
 

Protected Types

typedef std::vector< EventStackLayerEventStack
 Definition of a vector holding EventStackLayer objects which actually is used to implement a stack of these objects. More...
 
typedef ConcurrentCallbacks< EventCallbackEventCallbacks
 Definition of a vector holding event callback functions. More...
 
- Protected Types inherited from Ocean::Thread
typedef std::pair< pthread_t, bool > TimedJoinPair
 Definition of a pair holding a thread id and a boolean state. More...
 
enum  ThreadPriority {
  PRIORITY_IDLE , PRIORTY_BELOW_NORMAL , PRIORTY_NORMAL , PRIORTY_ABOVE_NORMAL ,
  PRIORTY_HIGH , PRIORTY_REALTIME
}
 Definition of different thread priority values. More...
 

Protected Member Functions

 OfflineTracker ()
 Creates a new offline tracker object. More...
 
void updateTrackerProgress (const Scalar localProgress)
 Updates the tracker process progress value of this tracker. More...
 
void updatePoses (const OfflinePoses &poses)
 Updates all poses of this tracker and invokes the corresponding state event(s). More...
 
void removeIrregularPoses (const Scalar factor=Scalar(5))
 Removes irregular poses at the boundary between valid and invalid poses. More...
 
void extrapolatePoses (const unsigned int number, const unsigned int base)
 Extrapolates poses at the boundary between valid and invalid poses. More...
 
- Protected Member Functions inherited from Ocean::Thread
 Thread (const Thread &thread)=delete
 Disabled copy constructor. More...
 
void createThread ()
 Creates the thread itself. More...
 
void destroyThread ()
 Destroys the thread itself. More...
 
void stopThreadExplicitly (const unsigned int timeout=5000u)
 Tries to stop the thread gracefully. More...
 
virtual void threadRun ()=0
 This function has to be overloaded in derived class. More...
 
Threadoperator= (const Thread &thread)=delete
 The disabled assign operator. More...
 
 Thread (const std::string &name=std::string())
 Creates a new thread object. More...
 
 Thread (const unsigned int randomNumberSeedValue, const std::string &name=std::string())
 Creates a new thread object. More...
 
virtual ~Thread ()
 Destructs a thread object. More...
 
bool startThread ()
 Starts the thread. More...
 
void stopThread ()
 Informs the thread to stop. More...
 
bool terminateThread ()
 Terminates the thread. More...
 
bool joinThread (const unsigned int timeout=(unsigned int)(-1))
 Waits until this thread has been stopped. More...
 
bool shouldThreadStop () const
 Returns whether this thread should stop. More...
 
bool isThreadInvokedToStart () const
 Returns whether this thread has been invoked to start immediately. More...
 
bool isThreadActive () const
 Returns whether this thread is active. More...
 

Static Protected Member Functions

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. More...
 
static void extrapolateSinglePose (const OfflinePoses::Index invalidIndex, OfflinePoses &offlinePoses)
 Interpolates the pose of a single invalid pose which is enclosed by two valid poses. More...
 
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. More...
 
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. More...
 
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. More...
 
static LockidCounterLock ()
 Returns a reference to the lock for the tracker id counter. More...
 
- Static Protected Member Functions inherited from Ocean::Thread
static void sleep (unsigned int ms)
 Sleeps the calling thread for a given time. More...
 
static void giveUp ()
 Gives up the remaining thread time. More...
 
static ThreadId currentThreadId ()
 Returns the thread id of the current (calling) thread. More...
 
static ThreadPriority threadPriority ()
 Returns the priority of the current thread. More...
 
static bool setThreadPriority (const ThreadPriority priority)
 Sets the priority of the current thread. More...
 
template<typename TObject , typename TExpectedValue >
static bool waitForValue (TObject &object, const TExpectedValue &expectedValue, const double timeout=-1.0)
 Waits until an object/variable has an expected value. More...
 
template<typename TObject , typename TExpectedValue >
static bool waitForValue (TObject &object, const TExpectedValue &expectedValue, TemporaryScopedLock &temporaryScopedLock, const double timeout=-1.0)
 Waits until an object/variable has an expected value. More...
 
static int pthread_timedjoin_np (pthread_t thread, void **retval, const struct timespec *abstime)
 Implements a thread join function with timeout value. More...
 

Protected Attributes

unsigned int id_ = 0u
 The unique id that identifies this tracker. More...
 
bool finished_ = true
 Finished state of the tracker. More...
 
bool shouldStop_ = false
 Stop-request state of the tracker, this state should have the same state as the threadShouldStop variable but will be accessible in all trackers. More...
 
OfflinePoses offlinePoses_
 Offline poses of this tracker. More...
 
EventCallbacks eventCallbacks_
 State event callback functions. More...
 
Lock lock_
 Tracker lock object. More...
 
EventStack eventStack_
 The stack with progress event layers allowing for a convenient process progress event handling. More...
 
Lock eventStackLock_
 The lock for the progress event layer stack. More...
 
Scalar previousProcessProgress_ = Scalar(0)
 The previous process progress. More...
 

Static Protected Attributes

static unsigned int idCounter_
 The tracker id counter. More...
 

Private Member Functions

void pushProgressEventStackLayer (const EventStackLayer &layer)
 Pushes a new progress event stack layer on the stack of this tracker. More...
 
void popProgressEventStackLayer (const EventStackLayer &layer)
 Pops a progress event stack layer from the stack of this tracker. More...
 

Friends

class EventStackLayer
 

Detailed Description

This class is the base class for all offline tracker objects.

See also
OfflineTrackerRef.

Member Typedef Documentation

◆ EventCallback

Definition of a component event callback function.

The first parameter provides the event.

◆ EventCallbacks

Definition of a vector holding event callback functions.

◆ EventStack

Definition of a vector holding EventStackLayer objects which actually is used to implement a stack of these objects.

Member Enumeration Documentation

◆ AbstractMotionType

Definition of individual abstract camera motion types.

Enumerator
AMT_UNKNOWN 

An unknown abstract camera motion.

AMT_PURE_ROTATIONAL 

A pure rotational camera motion.

AMT_COMPLEX 

A complex camera motion (may include rotational and translational motion).

◆ CameraModel

Definition of individual camera models.

Enumerator
CM_INVALID 

Invalid camera model parameter.

CM_LOW_QUALITY 

Low quality camera, equivalent to a state-of-the-art webcams.

CM_MEDIUM_QUALITY 

Medium camera model, equivalent to an amateur camera.

CM_HIGH_QUALITY 

High quality camera, equivalent to a professional cinema camera.

◆ TrackingQuality

Definition of individual tracking qualities.

Enumerator
TQ_LOW 

A low tracking quality with high performance.

TQ_MODERATE 

A moderate tracking quality with moderate performance.

TQ_HIGH 

A high tracking quality with low performance.

TQ_ULTRA 

A very high tracking quality with very low performance.

TQ_INSANE 

An insane tracking quality with very low performance.

TQ_AUTOMATIC 

Automatic tracking quality.

TQ_COARSE 

Coverage with coarse grid.

TQ_FINE 

Coverage with fine grid.

Constructor & Destructor Documentation

◆ ~OfflineTracker()

virtual Ocean::Tracking::Offline::OfflineTracker::~OfflineTracker ( )
virtual

Frees the offline tracker object.

◆ OfflineTracker()

Ocean::Tracking::Offline::OfflineTracker::OfflineTracker ( )
protected

Creates a new offline tracker object.

Member Function Documentation

◆ addEventCallback()

void Ocean::Tracking::Offline::OfflineTracker::addEventCallback ( const EventCallback callback)
inline

Adds a state event callback function.

Parameters
callbackThe callback function to be added

◆ extrapolateCenterPoses()

static void Ocean::Tracking::Offline::OfflineTracker::extrapolateCenterPoses ( const OfflinePoses::Index  invalidIndex,
const unsigned int  number,
const unsigned int  base,
OfflinePoses offlinePoses 
)
staticprotected

Interpolates some poses to the left or to the right of a gap with invalid poses.

Parameters
invalidIndexThe index of the invalid pose with valid poses
numberThe number of poses that will be extrapolated in the area
baseThe maximal number of poses that are used as interpolation base
offlinePosesThe offline poses on which the poses are extrapolated

◆ extrapolateLeftPoses()

static void Ocean::Tracking::Offline::OfflineTracker::extrapolateLeftPoses ( const OfflinePoses::Index  invalidIndex,
const unsigned int  number,
const unsigned int  base,
OfflinePoses offlinePoses 
)
staticprotected

Interpolates some poses to the left of a gap with invalid poses.

Parameters
invalidIndexThe index of the invalid pose with valid poses on the right
numberThe number of poses that will be extrapolated in the left area
baseThe maximal number of poses that are used as interpolation base
offlinePosesThe offline poses on which the poses are extrapolated

◆ extrapolatePoses()

void Ocean::Tracking::Offline::OfflineTracker::extrapolatePoses ( const unsigned int  number,
const unsigned int  base 
)
protected

Extrapolates poses at the boundary between valid and invalid poses.

Parameters
numberThe number of poses that will be extrapolated at each border
baseThe maximal number of poses that are used as interpolation base

◆ extrapolateRightPoses()

static void Ocean::Tracking::Offline::OfflineTracker::extrapolateRightPoses ( const OfflinePoses::Index  invalidIndex,
const unsigned int  number,
const unsigned int  base,
OfflinePoses offlinePoses 
)
staticprotected

Interpolates some poses to the right of a gap with invalid poses.

Parameters
invalidIndexThe index of the invalid pose with valid poses on the left
numberThe number of poses that will be extrapolated in the right area
baseThe maximal number of poses that are used as interpolation base
offlinePosesThe offline poses on which the poses are extrapolated

◆ extrapolateSinglePose()

static void Ocean::Tracking::Offline::OfflineTracker::extrapolateSinglePose ( const OfflinePoses::Index  invalidIndex,
OfflinePoses offlinePoses 
)
staticprotected

Interpolates the pose of a single invalid pose which is enclosed by two valid poses.

Parameters
invalidIndexThe index of the (single) invalid pose
offlinePosesThe offline poses on which the poses are extrapolated

◆ finished()

virtual bool Ocean::Tracking::Offline::OfflineTracker::finished ( ) const
virtual

Returns whether the offline tracker has finished since the last start or has not been started yet.

Returns
True, if so
See also
start().

◆ id()

unsigned int Ocean::Tracking::Offline::OfflineTracker::id ( ) const
inline

Returns the unique id of this tracker object.

Each tracker has an own unique id allowing to separate individual trackers or their events.

Returns
Unique tracker id

◆ idCounterLock()

static Lock& Ocean::Tracking::Offline::OfflineTracker::idCounterLock ( )
staticprotected

Returns a reference to the lock for the tracker id counter.

Returns
The lock for the tracker id counter

◆ isPlausibleCamera()

static bool Ocean::Tracking::Offline::OfflineTracker::isPlausibleCamera ( const PinholeCamera pinholeCamera,
const CameraModel  model 
)
staticprotected

Checks whether the camera parameters of a given camera profiles matches to the specified camera model.

Parameters
pinholeCameraThe pinhole camera profile that will be checked
modelThe model to that the camera profiles must match
Returns
True, if so

◆ popProgressEventStackLayer()

void Ocean::Tracking::Offline::OfflineTracker::popProgressEventStackLayer ( const EventStackLayer layer)
private

Pops a progress event stack layer from the stack of this tracker.

Do not call this function, this function will be called by the ScopedEventStackLayer object only.

Parameters
layerNew layer to be pushed
See also
ScopedEventStackLayer

◆ pose()

virtual OfflinePose Ocean::Tracking::Offline::OfflineTracker::pose ( const unsigned int  index) const
virtual

Returns one pose of this tracker.

Parameters
indexThe index of the frame for that the pose will be returned
Returns
Tracker pose

◆ poses()

virtual OfflinePoses Ocean::Tracking::Offline::OfflineTracker::poses ( ) const
virtual

Returns the currently determined poses of this tracker.

Returns
Tracker poses

◆ pushProgressEventStackLayer()

void Ocean::Tracking::Offline::OfflineTracker::pushProgressEventStackLayer ( const EventStackLayer layer)
private

Pushes a new progress event stack layer on the stack of this tracker.

Do not call this function, this function will be called by the ScopedEventStackLayer object only.

Parameters
layerNew layer to be pushed
See also
ScopedEventStackLayer

◆ removeEventCallback()

void Ocean::Tracking::Offline::OfflineTracker::removeEventCallback ( const EventCallback callback)
inline

Removes a state event callback function.

Parameters
callbackThe callback function to be removed

◆ removeIrregularPoses()

void Ocean::Tracking::Offline::OfflineTracker::removeIrregularPoses ( const Scalar  factor = Scalar(5))
protected

Removes irregular poses at the boundary between valid and invalid poses.

A pose is voted as irregular if the rotation angle between two successive frame is larger than the median rotation angle (between successive frame) multiplied by a factor.

Parameters
factorThe factor that is multiplied with the media angle

◆ running()

virtual bool Ocean::Tracking::Offline::OfflineTracker::running ( ) const
virtual

Returns whether the tracker has been started (and is currently tracking).

Returns
True, if so

◆ start()

virtual bool Ocean::Tracking::Offline::OfflineTracker::start ( )
virtual

Starts the offline tracker.

Returns
True, if succeeded
See also
stop(), finished().

Reimplemented in Ocean::Tracking::Offline::SLAMTracker, and Ocean::Tracking::Offline::FrameTracker.

◆ stop()

virtual bool Ocean::Tracking::Offline::OfflineTracker::stop ( const unsigned int  timeout = 0u)
virtual

Stops the offline tracker.

All poses that have been determined since the start of the tracker will be untouched.

Parameters
timeoutif 0, this call is asynchronous and will return immediately. Otherwise wait time in ms or -1 for infinite wait
Returns
True, if succeeded
See also
start().

Reimplemented in Ocean::Tracking::Offline::SLAMTracker.

◆ succeeded()

virtual bool Ocean::Tracking::Offline::OfflineTracker::succeeded ( ) const
pure virtual

Returns whether the offline tracker has finished and succeeded since the last start or has not been started yet.

Returns
True, if so
See also
finished().

Implemented in Ocean::Tracking::Offline::FrameTracker.

◆ updatePoses()

void Ocean::Tracking::Offline::OfflineTracker::updatePoses ( const OfflinePoses poses)
protected

Updates all poses of this tracker and invokes the corresponding state event(s).

Parameters
posesNew poses for this tracker

◆ updateTrackerProgress()

void Ocean::Tracking::Offline::OfflineTracker::updateTrackerProgress ( const Scalar  localProgress)
protected

Updates the tracker process progress value of this tracker.

This tracker stores a stack with EventStackLayer objects defining a hierarchy of individual relative progress ranges.
The given progress value should be independent of any stack layer and should simply give the progress state of e.g. a component.

Parameters
localProgressThe local progress value of e.g. a component, with range [0, 1]

Friends And Related Function Documentation

◆ EventStackLayer

friend class EventStackLayer
friend

Field Documentation

◆ eventCallbacks_

EventCallbacks Ocean::Tracking::Offline::OfflineTracker::eventCallbacks_
protected

State event callback functions.

◆ eventStack_

EventStack Ocean::Tracking::Offline::OfflineTracker::eventStack_
protected

The stack with progress event layers allowing for a convenient process progress event handling.

◆ eventStackLock_

Lock Ocean::Tracking::Offline::OfflineTracker::eventStackLock_
protected

The lock for the progress event layer stack.

◆ finished_

bool Ocean::Tracking::Offline::OfflineTracker::finished_ = true
protected

Finished state of the tracker.

◆ id_

unsigned int Ocean::Tracking::Offline::OfflineTracker::id_ = 0u
protected

The unique id that identifies this tracker.

◆ idCounter_

unsigned int Ocean::Tracking::Offline::OfflineTracker::idCounter_
staticprotected

The tracker id counter.

◆ lock_

Lock Ocean::Tracking::Offline::OfflineTracker::lock_
mutableprotected

Tracker lock object.

◆ offlinePoses_

OfflinePoses Ocean::Tracking::Offline::OfflineTracker::offlinePoses_
protected

Offline poses of this tracker.

◆ previousProcessProgress_

Scalar Ocean::Tracking::Offline::OfflineTracker::previousProcessProgress_ = Scalar(0)
protected

The previous process progress.

◆ shouldStop_

bool Ocean::Tracking::Offline::OfflineTracker::shouldStop_ = false
protected

Stop-request state of the tracker, this state should have the same state as the threadShouldStop variable but will be accessible in all trackers.


The documentation for this class was generated from the following file: