Ocean
Ocean::Tracking::UnidirectionalCorrespondences Class Reference

This class provides unidirectional feature correspondences. More...

Public Types

using CorrespondencePair = std::pair< unsigned int, unsigned int >
 Definition of a pair holding the indices of two corresponding features or descriptors. More...
 
using CorrespondencePairs = std::vector< CorrespondencePair >
 Definition of a vector holding correspondence pairs. More...
 

Public Member Functions

 UnidirectionalCorrespondences (const size_t numberForward, const size_t numberBackward)
 Creates a new unidirectional correspondences object. More...
 
template<bool tThreadSafe>
void addCandidate (const unsigned int forwardIndex, const unsigned int backwardIndex)
 Adds a new feature correspondence candidate. More...
 
CorrespondencePairs correspondences () const
 Returns all unidirectional feature correspondences. More...
 

Static Public Member Functions

template<typename TDescriptor , typename TDistance , TDistance(*)(const TDescriptor &, const TDescriptor &) tDistanceFunction>
static CorrespondencePairs determineCorrespondingDescriptors (const TDescriptor *forwardDescriptors, const size_t numberForwardDescriptors, const TDescriptor *backwardDescriptors, const size_t numberBackwardDescriptors, const TDistance maximalDistance, Worker *worker)
 Determines unidirectional correspondences pairs between two sets of descriptors. More...
 
template<typename TDescriptor , typename TDistance , TDistance(*)(const TDescriptor &, const TDescriptor &) tDistanceFunction>
static CorrespondencePairs determineCorrespondingFeatures (const AnyCamera &camera, const HomogenousMatrix4 &world_T_camera, const Vector3 *objectPoints, const TDescriptor *objectPointDescriptors, const size_t numberObjectFeatures, const Vector2 *imagePoints, const TDescriptor *imagePointDescriptors, const size_t numberImageFeatures, const TDistance maximalDistance, const Scalar maximalProjectionError)
 Determines guided unidirectional correspondence pairs between image features and object features. More...
 
template<typename TFirst , typename TSecond >
static void extractCorrespondenceElements (const CorrespondencePairs &correspondencePairs, const TFirst *firstElements, const size_t sizeFirstElements, const TSecond *secondElements, const size_t sizeSecondElements, std::vector< TFirst > &correspondenceFirstElements, std::vector< TSecond > &correspondenceSecondElements)
 Extracts corresponding elements based on correspondence pairs. More...
 

Static Protected Member Functions

template<typename TDescriptor , typename TDistance , TDistance(*)(const TDescriptor &, const TDescriptor &) tDistanceFunction, unsigned int tLocks>
static void determineCorrespondingDescriptorsSubset (const TDescriptor *forwardDescriptors, const size_t numberForwardDescriptors, const TDescriptor *backwardDescriptors, const size_t numberBackwardDescriptors, const TDistance maximalDistance, Index32 *forwardIndicesForBackwardDescriptors, Lock *locks, const unsigned int subsetFirstForwardDescriptor, const unsigned int subsetNumberForwardDescriptors)
 Determines a subset of all unidirectional correspondences pairs between two sets of descriptors. More...
 

Protected Attributes

Indices32 forwardCounters_
 Correspondence counter for forward features (or for the first features). More...
 
Indices32 backwardCounters_
 Correspondence counter for backward features (or for the second features). More...
 
CorrespondencePairs candidates_
 Correspondence candidates. More...
 
Lock lock_
 The object's lock. More...
 

Static Protected Attributes

static constexpr Index32 matchCountZero_ = Index32(-1)
 Definition of a match count value for zero matches. More...
 
static constexpr Index32 matchCounterTwo_ = Index32(-2)
 Definition of a match count value for two+ matches. More...
 

Detailed Description

This class provides unidirectional feature correspondences.

Member Typedef Documentation

◆ CorrespondencePair

using Ocean::Tracking::UnidirectionalCorrespondences::CorrespondencePair = std::pair<unsigned int, unsigned int>

Definition of a pair holding the indices of two corresponding features or descriptors.

◆ CorrespondencePairs

Definition of a vector holding correspondence pairs.

Constructor & Destructor Documentation

◆ UnidirectionalCorrespondences()

Ocean::Tracking::UnidirectionalCorrespondences::UnidirectionalCorrespondences ( const size_t  numberForward,
const size_t  numberBackward 
)

Creates a new unidirectional correspondences object.

Parameters
numberForwardThe number of forward features, with range [1, infinity)
numberBackwardThe number of backward features, with range [1, infinity)

Member Function Documentation

◆ addCandidate()

template<bool tThreadSafe>
void Ocean::Tracking::UnidirectionalCorrespondences::addCandidate ( const unsigned int  forwardIndex,
const unsigned int  backwardIndex 
)

Adds a new feature correspondence candidate.

Parameters
forwardIndexIndex of the forward feature or descriptor, with range [0, sizeForward-1]
backwardIndexIndex of the corresponding backward feature or descriptor, with range [0, sizeBackward-1]
Template Parameters
tThreadSafeTrue, in case the call needs to be thread-safe; False, if no other thread is currently using this correspondence object

◆ correspondences()

CorrespondencePairs Ocean::Tracking::UnidirectionalCorrespondences::correspondences ( ) const

Returns all unidirectional feature correspondences.

Returns
The resulting unique feature correspondences

◆ determineCorrespondingDescriptors()

template<typename TDescriptor , typename TDistance , TDistance(*)(const TDescriptor &, const TDescriptor &) tDistanceFunction>
UnidirectionalCorrespondences::CorrespondencePairs Ocean::Tracking::UnidirectionalCorrespondences::determineCorrespondingDescriptors ( const TDescriptor *  forwardDescriptors,
const size_t  numberForwardDescriptors,
const TDescriptor *  backwardDescriptors,
const size_t  numberBackwardDescriptors,
const TDistance  maximalDistance,
Worker worker 
)
static

Determines unidirectional correspondences pairs between two sets of descriptors.

Parameters
forwardDescriptorsThe first (forward) set of descriptors, can be invalid if 'numberForwardDescriptors == 0'
numberForwardDescriptorsThe number of descriptors in the first set, with range [0, infinity)
backwardDescriptorsThe second (backward) set of descriptors, can be invalid if 'numberBackwardDescriptors == 0'
numberBackwardDescriptorsThe number of descriptors in the second set, with range [0, infinity)
maximalDistanceThe maximal distance between two descriptors to count as match, with range [0, infinity) @parma worker Optional worker to distribute the computation
Returns
The resulting pairs with unidirectional correspondences
Template Parameters
TDescriptorThe data type of the descriptors
TDistanceThe data type of the distance between two descriptors
tDistanceFunctionThe function returning the distance between two descriptors

◆ determineCorrespondingDescriptorsSubset()

template<typename TDescriptor , typename TDistance , TDistance(*)(const TDescriptor &, const TDescriptor &) tDistanceFunction, unsigned int tLocks>
void Ocean::Tracking::UnidirectionalCorrespondences::determineCorrespondingDescriptorsSubset ( const TDescriptor *  forwardDescriptors,
const size_t  numberForwardDescriptors,
const TDescriptor *  backwardDescriptors,
const size_t  numberBackwardDescriptors,
const TDistance  maximalDistance,
Index32 forwardIndicesForBackwardDescriptors,
Lock locks,
const unsigned int  subsetFirstForwardDescriptor,
const unsigned int  subsetNumberForwardDescriptors 
)
staticprotected

Determines a subset of all unidirectional correspondences pairs between two sets of descriptors.

Parameters
forwardDescriptorsThe first (forward) set of descriptors, must be valid
numberForwardDescriptorsThe number of descriptors in the first set, with range [1, infinity)
backwardDescriptorsThe second (backward) set of descriptors, must be valid
numberBackwardDescriptorsThe number of descriptors in the second set, with range [1, infinity)
maximalDistanceThe maximal distance between two descriptors to count as match, with range [0, infinity)
forwardIndicesForBackwardDescriptorsThe individual indices of matching forward descriptors, one for each backward descriptor
locksThe 'tLocks' locks elements, must be valid if 'tLocks >= 1'
subsetFirstForwardDescriptorThe first forward descriptor to be handled, with range [0, numberForwardDescriptors-1]
subsetNumberForwardDescriptorsThe number of forward descriptors to be handled, with range [1, numberForwardDescriptors-subsetFirstForwardDescriptor]
Returns
The resulting pairs with unidirectional correspondences
Template Parameters
TDescriptorThe data type of the descriptors
TDistanceThe data type of the distance between two descriptors
tDistanceFunctionThe function returning the distance between two descriptors
tLocksThe number of provided lock objects, with range [0, infinity)

◆ determineCorrespondingFeatures()

template<typename TDescriptor , typename TDistance , TDistance(*)(const TDescriptor &, const TDescriptor &) tDistanceFunction>
UnidirectionalCorrespondences::CorrespondencePairs Ocean::Tracking::UnidirectionalCorrespondences::determineCorrespondingFeatures ( const AnyCamera camera,
const HomogenousMatrix4 world_T_camera,
const Vector3 objectPoints,
const TDescriptor *  objectPointDescriptors,
const size_t  numberObjectFeatures,
const Vector2 imagePoints,
const TDescriptor *  imagePointDescriptors,
const size_t  numberImageFeatures,
const TDistance  maximalDistance,
const Scalar  maximalProjectionError 
)
static

Determines guided unidirectional correspondence pairs between image features and object features.

The resulting matches are guided based on a given rough 6-DOF camera pose.

Parameters
cameraThe camera profile defining the projection, must be valid
world_T_cameraThe rough 6-DOF pose of the camera, with default camera pointing towards the negative z-space with y-axis upwards
objectPointsThe 3D locations of the 3D object features, one for each object feature, must be valid
objectPointDescriptorsThe descriptors of the 3D object features, one for each object feature, must be valid
numberObjectFeaturesThe number of 3D object features, with range [1, infinity)
imagePointsThe 2D location of the 2D image features, one for each image feature, must be valid
imagePointDescriptorsThe descriptors of the 2D image features, one for each image feature, must be valid
numberImageFeaturesThe number of 2D image features, with range [1, infinity)
maximalDistanceThe maximal distance between two descriptors (an object descriptor and an image descriptor) to count as match, with range [0, infinity)
maximalProjectionErrorThe maximal projection error between image features and projected object features to count as candidate (allows to balance the number of candidates based on the precision of the given camera pose), in pixels, with range [0, infinity)
Template Parameters
TDescriptorThe data type of the descriptors
TDistanceThe data type of the distance between two descriptors
tDistanceFunctionThe function returning the distance between two descriptors

◆ extractCorrespondenceElements()

template<typename TFirst , typename TSecond >
void Ocean::Tracking::UnidirectionalCorrespondences::extractCorrespondenceElements ( const CorrespondencePairs correspondencePairs,
const TFirst *  firstElements,
const size_t  sizeFirstElements,
const TSecond *  secondElements,
const size_t  sizeSecondElements,
std::vector< TFirst > &  correspondenceFirstElements,
std::vector< TSecond > &  correspondenceSecondElements 
)
static

Extracts corresponding elements based on correspondence pairs.

Parameters
correspondencePairsThe correspondence pairs providing the individual indices of the elements to be extracted
firstElementsThe entire set of first elements, the first index of each correspondence pair belongs to these elements, must be valid
sizeFirstElementsThe size of the entire set of first elements, with range [1, infinity)
secondElementsThe entire set of second elements, the second index of each correspondence pair belongs to these elements, must be valid
sizeSecondElementsThe size of the entire set of second elements, with range [1, infinity)
correspondenceFirstElementsThe resulting elements from the first set which were defined in the provided correspondence pairs
correspondenceSecondElementsThe resulting elements from the second set which were define i the provided correspondence pairs, one for each elements in correspondenceFirstElements
Template Parameters
TFirstThe data type of the first elements
TSecondThe data type of the second elements

Field Documentation

◆ backwardCounters_

Indices32 Ocean::Tracking::UnidirectionalCorrespondences::backwardCounters_
protected

Correspondence counter for backward features (or for the second features).

◆ candidates_

CorrespondencePairs Ocean::Tracking::UnidirectionalCorrespondences::candidates_
protected

Correspondence candidates.

◆ forwardCounters_

Indices32 Ocean::Tracking::UnidirectionalCorrespondences::forwardCounters_
protected

Correspondence counter for forward features (or for the first features).

◆ lock_

Lock Ocean::Tracking::UnidirectionalCorrespondences::lock_
mutableprotected

The object's lock.

◆ matchCounterTwo_

constexpr Index32 Ocean::Tracking::UnidirectionalCorrespondences::matchCounterTwo_ = Index32(-2)
staticconstexprprotected

Definition of a match count value for two+ matches.

◆ matchCountZero_

constexpr Index32 Ocean::Tracking::UnidirectionalCorrespondences::matchCountZero_ = Index32(-1)
staticconstexprprotected

Definition of a match count value for zero matches.


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