Ocean
Ocean::Tracking::Point::SimilarityTracker Class Reference

This class implements a tracker determining a similarity transformation between two successive video frames. More...

Public Types

enum  TrackerConfidence {
  TC_NONE , TC_BAD , TC_MODERATE , TC_GOOD ,
  TC_VERY_GOOD
}
 Definition of individual confidence values. More...
 
enum  RegionTextureness { RT_UNKNOWN , RT_LOW , RT_MODERATE , RT_HIGH }
 Definition of individual textureness qualities. More...
 

Public Member Functions

 SimilarityTracker ()=default
 Creates a new tracker object. More...
 
bool determineSimilarity (const Frame &yFrame, const CV::PixelBoundingBox &previousSubRegion, SquareMatrix3 *currentTprevious=nullptr, Vector2 *translation=nullptr, Scalar *rotation=nullptr, Scalar *scale=nullptr, const Vector2 &predictedTranslation=Vector2(0, 0), TrackerConfidence *trackerConfidence=nullptr, RegionTextureness *regionTextureness=nullptr, Worker *worker=nullptr)
 Determines the similarity between two successive video frame within a specified sub-region. More...
 
const CV::FramePyramidcurrentFramePyramid () const
 Returns the frame pyramid of the most recent frame. More...
 
const CV::FramePyramidkeyFramePyramid () const
 Returns the frame pyramid of one of the previous frames (the current key-frame). More...
 
void reset ()
 Resets the similarity tracker. More...
 

Static Public Member Functions

static float combinedConfidence (const TrackerConfidence trackerConfidence, const RegionTextureness regionTextureness)
 Calculate an overall confidence values based on a tracker confidence and a region textureness. More...
 

Static Protected Member Functions

static bool determineFeaturePoints (const CV::FramePyramid &yFramePyramid, const CV::PixelBoundingBox &subRegion, const size_t minimalFeaturePoints, const size_t desiredFeaturePoints, const size_t maximalFeaturePoints, Vectors2 &featurePoints, unsigned int &usedLayerIndex, RegionTextureness &regionTextureness, Worker *worker=nullptr)
 Detects feature points in given frame for which a frame pyramid exists. More...
 
static bool determineSimilarityTransformation (const CV::FramePyramid &yPreviousFramePyramid, const CV::FramePyramid &yCurrentFramePyramid, const Vectors2 &previousPoints, const Vectors2 &roughCurrentPoints, RandomGenerator &randomGenerator, SquareMatrix3 &currentTprevious, Indices32 &validCorrespondences, const unsigned int coarsestLayerRadius, const unsigned int subPixelIterations, Worker *worker=nullptr)
 Determines the similarity transformation between two successive frames. More...
 

Protected Attributes

CV::FramePyramid keyFramePyramid_
 The frame pyramid of the key frame, one of the previous frames. More...
 
CV::FramePyramid currentFramePyramid_
 The frame pyramid of the current frame. More...
 
RandomGenerator randomGenerator_
 The random generator object. More...
 
SquareMatrix3 previous_T_key_ = SquareMatrix3(true)
 The similarity since 'previousFramePyramid_' have been updated the last time, defined in the resolution of the usage pyramid layer. More...
 
Vectors2 keyFramePoints_
 The image points located in 'previousFramePyramid_', defined in the usage pyramid layer. More...
 
unsigned int keyFramePointsLayerIndex_ = (unsigned int)(-1)
 The frame pyramid layer index in which 'keyFramePoints_' have been determined, -1 if invalid. More...
 

Detailed Description

This class implements a tracker determining a similarity transformation between two successive video frames.

A similarity transformation has four degrees of freedom and contains a rotation, a scale, and a 2D translation (in x- and y- direction) within the image domain.
The 3x3 matrix representing the similarity transformation has the following layout:

| a  -b  tx |
| b   a  ty |
| 0   0   1 |

Member Enumeration Documentation

◆ RegionTextureness

Definition of individual textureness qualities.

Enumerator
RT_UNKNOWN 

The textureness is unknown.

RT_LOW 

The textureness is low (an almost homogeneous region).

RT_MODERATE 

The textureness is moderate.

RT_HIGH 

The textureness is high (an almost heterogeneous region).

◆ TrackerConfidence

Definition of individual confidence values.

Enumerator
TC_NONE 

No similarity could be determined.

TC_BAD 

The determined similarity may have a bad quality.

TC_MODERATE 

The determined similarity has a moderate quality.

TC_GOOD 

The determined similarity has a good quality.

TC_VERY_GOOD 

The determined similarity has a very good quality and can be trusted regardless.

Constructor & Destructor Documentation

◆ SimilarityTracker()

Ocean::Tracking::Point::SimilarityTracker::SimilarityTracker ( )
default

Creates a new tracker object.

Member Function Documentation

◆ combinedConfidence()

float Ocean::Tracking::Point::SimilarityTracker::combinedConfidence ( const TrackerConfidence  trackerConfidence,
const RegionTextureness  regionTextureness 
)
inlinestatic

Calculate an overall confidence values based on a tracker confidence and a region textureness.

Parameters
trackerConfidenceThe confidence value of the tracker
regionTexturenessThe textureness of the sub-region in which the tracker was applied
Returns
The resulting overall confidence value, with range [0, 1]

◆ currentFramePyramid()

const CV::FramePyramid & Ocean::Tracking::Point::SimilarityTracker::currentFramePyramid ( ) const
inline

Returns the frame pyramid of the most recent frame.

Returns
Frame pyramid of current frame, if any

◆ determineFeaturePoints()

static bool Ocean::Tracking::Point::SimilarityTracker::determineFeaturePoints ( const CV::FramePyramid yFramePyramid,
const CV::PixelBoundingBox subRegion,
const size_t  minimalFeaturePoints,
const size_t  desiredFeaturePoints,
const size_t  maximalFeaturePoints,
Vectors2 featurePoints,
unsigned int &  usedLayerIndex,
RegionTextureness regionTextureness,
Worker worker = nullptr 
)
staticprotected

Detects feature points in given frame for which a frame pyramid exists.

The points may be determined in a lower image resolution if enough features can be found.

Parameters
yFramePyramidThe frame pyramid of the frame in which the feature points will be determined, with pixel format FORMAT_Y8, must be valid with at least one layer
subRegionThe sub-region inside the frame in which feature points will be determined, specified in the domain of the finest image resolution, must be valid
minimalFeaturePointsThe minimal number of feature points that must be detected so that the function succeeds, with range [1, infinity)
desiredFeaturePointsThe desired number of feature points that should be detected in an ideal case, with range [minimalFeaturePoints, infinity)
maximalFeaturePointsThe maximal number of feature points that will be detected, with range [desiredFeaturePoints, infinity)
featurePointsThe resulting detected feature points, defined in the domain of the pyramid layer as returned by 'usedLayerIndex'
usedLayerIndexThe pyramid layer in which the resulting feature points have been detected, with range [0, framePyramid.layers() - 1]
regionTexturenessThe resulting textureness of the sub-region (which is based on the numbers of found feature etc.)
workerOptional worker object to distribute the computation
Returns
True, if at least 'minimalFeaturePoints' could be determined

◆ determineSimilarity()

bool Ocean::Tracking::Point::SimilarityTracker::determineSimilarity ( const Frame yFrame,
const CV::PixelBoundingBox previousSubRegion,
SquareMatrix3 currentTprevious = nullptr,
Vector2 translation = nullptr,
Scalar rotation = nullptr,
Scalar scale = nullptr,
const Vector2 predictedTranslation = Vector2(0, 0),
TrackerConfidence trackerConfidence = nullptr,
RegionTextureness regionTextureness = nullptr,
Worker worker = nullptr 
)

Determines the similarity between two successive video frame within a specified sub-region.

Parameters
yFrameThe 8bit grayscale frame for which the similarity (in relation to the previous frame) will be determined, with image dimension [40, infinity)x[40, infinity) must be valid
previousSubRegionThe sub-region (in the previous frame) in which feature points will be determined and tracked to from the previous frame to the current frame, must be valid, must not lie outside the frame
currentTpreviousOptional resulting 3x3 matrix containing the entire similarity transformation: currentPoint = similarity * previousPoint
translationOptional resulting translation between the current and the previous video frame, in pixel, with range (-infinity, infinity)x(-infinity, infinity)
rotationOptional resulting rotation between the current and the previous video frame, in radian, with range [-PI, PI]
scaleOptional resulting scale between the current and the previous video frame, with range (0, infinity)
predictedTranslationThe predicted translation between the previous frame and the current frame if known, may be based on e.g., a gyro motion
trackerConfidenceOptional resulting confidence value of the tracker
regionTexturenessOptional resulting textureness of the provided sub-region
workerOptional worker object to distribute the computation
Returns
True, if succeeded, use trackerConfidence to check whether the resulting tracking data is valid

◆ determineSimilarityTransformation()

static bool Ocean::Tracking::Point::SimilarityTracker::determineSimilarityTransformation ( const CV::FramePyramid yPreviousFramePyramid,
const CV::FramePyramid yCurrentFramePyramid,
const Vectors2 previousPoints,
const Vectors2 roughCurrentPoints,
RandomGenerator randomGenerator,
SquareMatrix3 currentTprevious,
Indices32 validCorrespondences,
const unsigned int  coarsestLayerRadius,
const unsigned int  subPixelIterations,
Worker worker = nullptr 
)
staticprotected

Determines the similarity transformation between two successive frames.

Parameters
yPreviousFramePyramidThe frame pyramid of the previous frame in which the given 'previousPoints' are located, with pixel format FORMAT_Y8, must be valid with at least one layer
yCurrentFramePyramidThe frame pyramid of the current frame to which the previous points will be tracked, must have the same format and layout as 'yPreviousFramePyramid'
previousPointsThe previous feature points defined within the domain of the finest pyramid layer of 'yPreviousFramePyramid', at least one
roughCurrentPointsOptional the already known rough locations of the previous points with the current frame, one for each previous point, otherwise an empty vector
randomGeneratorThe object to be used to generate random numbers
currentTpreviousThe resulting similarity transformation matching with the resolution of f the finest pyramid layer, transforming points defined in the previous frame to points in the current frame: (currentPoint = currentTprevious * previousPoint)
validCorrespondencesThe resulting indices of all previous feature points that have been used for determination of the similarity transformation
coarsestLayerRadiusThe search radius on the coarsest layer in pixel, with range [2, infinity)
subPixelIterationsNumber of sub-pixel iterations that will be applied, each iteration doubles the sub-pixel accuracy, with range [1, infinity)
workerOptional worker object to distribute the computation
Returns
True, if succeeded

◆ keyFramePyramid()

const CV::FramePyramid & Ocean::Tracking::Point::SimilarityTracker::keyFramePyramid ( ) const
inline

Returns the frame pyramid of one of the previous frames (the current key-frame).

Returns
Frame pyramid of previous frame, if any

◆ reset()

void Ocean::Tracking::Point::SimilarityTracker::reset ( )
inline

Resets the similarity tracker.

Field Documentation

◆ currentFramePyramid_

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

The frame pyramid of the current frame.

◆ keyFramePoints_

Vectors2 Ocean::Tracking::Point::SimilarityTracker::keyFramePoints_
protected

The image points located in 'previousFramePyramid_', defined in the usage pyramid layer.

◆ keyFramePointsLayerIndex_

unsigned int Ocean::Tracking::Point::SimilarityTracker::keyFramePointsLayerIndex_ = (unsigned int)(-1)
protected

The frame pyramid layer index in which 'keyFramePoints_' have been determined, -1 if invalid.

◆ keyFramePyramid_

CV::FramePyramid Ocean::Tracking::Point::SimilarityTracker::keyFramePyramid_
protected

The frame pyramid of the key frame, one of the previous frames.

◆ previous_T_key_

SquareMatrix3 Ocean::Tracking::Point::SimilarityTracker::previous_T_key_ = SquareMatrix3(true)
protected

The similarity since 'previousFramePyramid_' have been updated the last time, defined in the resolution of the usage pyramid layer.

◆ randomGenerator_

RandomGenerator Ocean::Tracking::Point::SimilarityTracker::randomGenerator_
protected

The random generator object.


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