Ocean
Ocean::Tracking::Point::PointTracker Class Reference

This class implements a point tracker able to track points between concurrent frames and stores previous points in a database. More...

Public Types

enum  TrackingMode : uint32_t {
  TM_SSD_7 , TM_SSD_15 , TM_SSD_31 , TM_ZM_SSD_7 ,
  TM_ZM_SSD_15 , TM_ZM_SSD_31 , TM_END
}
 Definition of individual tracking modes. More...
 
typedef std::vector< Vectors2PointTracks
 Definition of a vector holding 2D vectors. More...
 

Public Member Functions

 PointTracker ()
 Creates a new point tracker. More...
 
 PointTracker (PointTracker &&pointTracker) noexcept
 Move constructor. More...
 
 PointTracker (const PointTracker &pointTracker)
 Copy constructor. More...
 
void setTrackingMode (const TrackingMode trackingMode)
 Sets or changes the tracking mode. More...
 
TrackingMode trackingMode () const
 Returns the current tracking mode. More...
 
Index32 newFrame (const Frame &yFrame, Worker *worker=nullptr)
 Tracks object points (feature points) in a new frame. More...
 
PointTracks pointTracks (const Index32 imageIndex, const unsigned int maximalLength=(unsigned int)(-1))
 Returns the point tracks for all object points. More...
 
void clearUpTo (const unsigned int frameIndex)
 Removes all entries from the tracking database older than a specified frame index. More...
 
void clear ()
 Clears the database containing the object points and their corresponding image points. More...
 
Databasedatabase ()
 Returns the internal database storing the topology of the tracked points. More...
 
PointTrackeroperator= (PointTracker &&pointTracker) noexcept
 Move operator. More...
 
PointTrackeroperator= (const PointTracker &pointTracker)
 Assign operator. More...
 

Static Public Attributes

static constexpr Index32 invalidFrameIndex = Index32(-1)
 Definition of an invalid frame index. More...
 

Protected Member Functions

void detectNewFeaturePoints (const Frame &yFrame, Geometry::SpatialDistribution::OccupancyArray &occupancyArray, Vectors2 &newFeaturePoints, Worker *worker=nullptr)
 Detects new feature points in empty regions of the provided frame. More...
 

Static Protected Member Functions

static bool trackFeaturePoints (const TrackingMode trackingMode, const CV::FramePyramid &previousFramePyramid, const CV::FramePyramid &currentFramePyramid, Vectors2 &previousImagePoints, Vectors2 &currentImagePoints, Indices32 &validIndices, Worker *worker)
 Tracks feature points from one frame (pyramid) to another frame (pyramid). More...
 

Protected Attributes

TrackingMode trackingMode_ = TM_ZM_SSD_7
 The tracking mode to be used. More...
 
Database database_
 The database storing the object points (feature points) and their corresponding image points. More...
 
CV::FramePyramid previousFramePyramid_
 The frame pyramid of the previous frame. More...
 
CV::FramePyramid currentFramePyramid_
 The frame pyramid of the current frame. More...
 
Index32 previousFrameIndex_ = invalidFrameIndex
 The index of the previous frame. More...
 
unsigned int featurePointStrengthThreshold_ = 15u
 Threshold for strengths of feature points, with range [1, 255]. More...
 
unsigned int binSize_ = 40u
 The size of each bin (edge length) in pixel controlling whether new feature points will be added in an empty region. More...
 
Lock lock_
 The lock for this tracker. More...
 

Detailed Description

This class implements a point tracker able to track points between concurrent frames and stores previous points in a database.

The tracker determines feature points in the very first frame - and stored as object points (feature points).
Those points are tracked from one frame to another frame as long as possible.
All points are tracked from the previous frame to the current frame (and not from a common reference frame to the current frame).
Whenever an object point (feature point) is lost the tracker will add a new feature point in the empty region - so that the tracker is always tracking a high number of feature points.
Tracking is based on matches between small image patches around the image points.

Member Typedef Documentation

◆ PointTracks

Definition of a vector holding 2D vectors.

Member Enumeration Documentation

◆ TrackingMode

Definition of individual tracking modes.

Enumerator
TM_SSD_7 

Sum square differences tracking with 7 pixel image patch.

TM_SSD_15 

Sum square differences tracking with 15 pixel image patch.

TM_SSD_31 

Sum square differences tracking with 31 pixel image patch.

TM_ZM_SSD_7 

Zero-mean sum square differences tracking with 7 pixel image patch.

TM_ZM_SSD_15 

Zero-mean sum square differences tracking with 15 pixel image patch.

TM_ZM_SSD_31 

Zero-mean sum square differences tracking with 31 pixel image patch.

TM_END 

End mode.

Constructor & Destructor Documentation

◆ PointTracker() [1/3]

Ocean::Tracking::Point::PointTracker::PointTracker ( )

Creates a new point tracker.

◆ PointTracker() [2/3]

Ocean::Tracking::Point::PointTracker::PointTracker ( PointTracker &&  pointTracker)
noexcept

Move constructor.

Parameters
pointTrackerThe tracker object to be moved

◆ PointTracker() [3/3]

Ocean::Tracking::Point::PointTracker::PointTracker ( const PointTracker pointTracker)

Copy constructor.

Parameters
pointTrackerThe tracker object to be copied

Member Function Documentation

◆ clear()

void Ocean::Tracking::Point::PointTracker::clear ( )
inline

Clears the database containing the object points and their corresponding image points.

See also
clearUpTo().

◆ clearUpTo()

void Ocean::Tracking::Point::PointTracker::clearUpTo ( const unsigned int  frameIndex)

Removes all entries from the tracking database older than a specified frame index.

Parameters
frameIndexThe index of the frame which will be the first frame in the database for which data exists
See also
clear().

◆ database()

Database & Ocean::Tracking::Point::PointTracker::database ( )
inline

Returns the internal database storing the topology of the tracked points.

Beware: This function is not thread-safe.

Returns
The tracker's database

◆ detectNewFeaturePoints()

void Ocean::Tracking::Point::PointTracker::detectNewFeaturePoints ( const Frame yFrame,
Geometry::SpatialDistribution::OccupancyArray occupancyArray,
Vectors2 newFeaturePoints,
Worker worker = nullptr 
)
protected

Detects new feature points in empty regions of the provided frame.

Parameters
yFrameThe provided frame in which new feature points will be detected, must have pixel format FORMAT_Y8, must be valid
occupancyArrayThe occupancy array specifying empty and non-empty regions in the frame, must be valid
newFeaturePointsThe resulting new feature points
workerOptional worker object to distribute the computation

◆ newFrame()

Index32 Ocean::Tracking::Point::PointTracker::newFrame ( const Frame yFrame,
Worker worker = nullptr 
)

Tracks object points (feature points) in a new frame.

Parameters
yFrameThe new frame in which the points will be tracked, must have pixel format FORMAT_Y8, must be valid
workerOptional worker object to distribute the computation
Returns
The index of the new frame, 'invalidFrameIndex' if something went wrong

◆ operator=() [1/2]

PointTracker& Ocean::Tracking::Point::PointTracker::operator= ( const PointTracker pointTracker)

Assign operator.

Parameters
pointTrackerThe tracker object to be moved
Returns
Reference to this object

◆ operator=() [2/2]

PointTracker& Ocean::Tracking::Point::PointTracker::operator= ( PointTracker &&  pointTracker)
noexcept

Move operator.

Parameters
pointTrackerThe tracker object to be moved
Returns
Reference to this object

◆ pointTracks()

PointTracks Ocean::Tracking::Point::PointTracker::pointTracks ( const Index32  imageIndex,
const unsigned int  maximalLength = (unsigned int)(-1) 
)

Returns the point tracks for all object points.

One track is a connected path of images points belonging to one object point (feature point).

Parameters
imageIndexThe index of the frame for which the tracks will be provided
maximalLengthThe maximal length of each track (the maximal number of image points for each object point), with range [1, infinity)
Returns
The tracks of tracked object points starting at the specified frame (and going into the past)

◆ setTrackingMode()

void Ocean::Tracking::Point::PointTracker::setTrackingMode ( const TrackingMode  trackingMode)
inline

Sets or changes the tracking mode.

Parameters
trackingModeThe new tracking mode

◆ trackFeaturePoints()

static bool Ocean::Tracking::Point::PointTracker::trackFeaturePoints ( const TrackingMode  trackingMode,
const CV::FramePyramid previousFramePyramid,
const CV::FramePyramid currentFramePyramid,
Vectors2 previousImagePoints,
Vectors2 currentImagePoints,
Indices32 validIndices,
Worker worker 
)
staticprotected

Tracks feature points from one frame (pyramid) to another frame (pyramid).

Parameters
trackingModeThe tracking mode to be used, must be valid
previousFramePyramidThe frame pyramid of the previous frame, must be valid
currentFramePyramidThe frame pyramid of the current frame, must be valid
previousImagePointsThe image points located in the previous frame which will be tracked to the current frame, at least one point
currentImagePointsThe resulting image points located in the current image, one for each previous image points
validIndicesThe indices of all point correspondences that could be tracked reliably (all other correspondences are invalid)
workerOptional worker object to distribute the computation
Returns
True, if succeeded

◆ trackingMode()

PointTracker::TrackingMode Ocean::Tracking::Point::PointTracker::trackingMode ( ) const
inline

Returns the current tracking mode.

Returns
The point tracker's tracking mode

Field Documentation

◆ binSize_

unsigned int Ocean::Tracking::Point::PointTracker::binSize_ = 40u
protected

The size of each bin (edge length) in pixel controlling whether new feature points will be added in an empty region.

◆ currentFramePyramid_

CV::FramePyramid Ocean::Tracking::Point::PointTracker::currentFramePyramid_
protected

The frame pyramid of the current frame.

◆ database_

Database Ocean::Tracking::Point::PointTracker::database_
protected

The database storing the object points (feature points) and their corresponding image points.

◆ featurePointStrengthThreshold_

unsigned int Ocean::Tracking::Point::PointTracker::featurePointStrengthThreshold_ = 15u
protected

Threshold for strengths of feature points, with range [1, 255].

◆ invalidFrameIndex

constexpr Index32 Ocean::Tracking::Point::PointTracker::invalidFrameIndex = Index32(-1)
staticconstexpr

Definition of an invalid frame index.

◆ lock_

Lock Ocean::Tracking::Point::PointTracker::lock_
mutableprotected

The lock for this tracker.

◆ previousFrameIndex_

Index32 Ocean::Tracking::Point::PointTracker::previousFrameIndex_ = invalidFrameIndex
protected

The index of the previous frame.

◆ previousFramePyramid_

CV::FramePyramid Ocean::Tracking::Point::PointTracker::previousFramePyramid_
protected

The frame pyramid of the previous frame.

◆ trackingMode_

TrackingMode Ocean::Tracking::Point::PointTracker::trackingMode_ = TM_ZM_SSD_7
protected

The tracking mode to be used.


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