Ocean
|
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< Vectors2 > | PointTracks |
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... | |
Database & | database () |
Returns the internal database storing the topology of the tracked points. More... | |
PointTracker & | operator= (PointTracker &&pointTracker) noexcept |
Move operator. More... | |
PointTracker & | operator= (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 ¤tFramePyramid, Vectors2 &previousImagePoints, Vectors2 ¤tImagePoints, 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... | |
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.
typedef std::vector<Vectors2> Ocean::Tracking::Point::PointTracker::PointTracks |
Definition of a vector holding 2D vectors.
enum Ocean::Tracking::Point::PointTracker::TrackingMode : uint32_t |
Definition of individual tracking modes.
Ocean::Tracking::Point::PointTracker::PointTracker | ( | ) |
Creates a new point tracker.
|
noexcept |
Move constructor.
pointTracker | The tracker object to be moved |
Ocean::Tracking::Point::PointTracker::PointTracker | ( | const PointTracker & | pointTracker | ) |
Copy constructor.
pointTracker | The tracker object to be copied |
|
inline |
Clears the database containing the object points and their corresponding image points.
void Ocean::Tracking::Point::PointTracker::clearUpTo | ( | const unsigned int | frameIndex | ) |
Removes all entries from the tracking database older than a specified frame index.
frameIndex | The index of the frame which will be the first frame in the database for which data exists |
|
inline |
Returns the internal database storing the topology of the tracked points.
Beware: This function is not thread-safe.
|
protected |
Detects new feature points in empty regions of the provided frame.
yFrame | The provided frame in which new feature points will be detected, must have pixel format FORMAT_Y8, must be valid |
occupancyArray | The occupancy array specifying empty and non-empty regions in the frame, must be valid |
newFeaturePoints | The resulting new feature points |
worker | Optional worker object to distribute the computation |
Index32 Ocean::Tracking::Point::PointTracker::newFrame | ( | const Frame & | yFrame, |
Worker * | worker = nullptr |
||
) |
Tracks object points (feature points) in a new frame.
yFrame | The new frame in which the points will be tracked, must have pixel format FORMAT_Y8, must be valid |
worker | Optional worker object to distribute the computation |
PointTracker& Ocean::Tracking::Point::PointTracker::operator= | ( | const PointTracker & | pointTracker | ) |
Assign operator.
pointTracker | The tracker object to be moved |
|
noexcept |
Move operator.
pointTracker | The tracker object to be moved |
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).
imageIndex | The index of the frame for which the tracks will be provided |
maximalLength | The maximal length of each track (the maximal number of image points for each object point), with range [1, infinity) |
|
inline |
Sets or changes the tracking mode.
trackingMode | The new tracking mode |
|
staticprotected |
Tracks feature points from one frame (pyramid) to another frame (pyramid).
trackingMode | The tracking mode to be used, must be valid |
previousFramePyramid | The frame pyramid of the previous frame, must be valid |
currentFramePyramid | The frame pyramid of the current frame, must be valid |
previousImagePoints | The image points located in the previous frame which will be tracked to the current frame, at least one point |
currentImagePoints | The resulting image points located in the current image, one for each previous image points |
validIndices | The indices of all point correspondences that could be tracked reliably (all other correspondences are invalid) |
worker | Optional worker object to distribute the computation |
|
inline |
Returns the current tracking mode.
|
protected |
The size of each bin (edge length) in pixel controlling whether new feature points will be added in an empty region.
|
protected |
The frame pyramid of the current frame.
|
protected |
The database storing the object points (feature points) and their corresponding image points.
|
protected |
Threshold for strengths of feature points, with range [1, 255].
|
staticconstexpr |
Definition of an invalid frame index.
|
mutableprotected |
The lock for this tracker.
|
protected |
The index of the previous frame.
|
protected |
The frame pyramid of the previous frame.
|
protected |
The tracking mode to be used.