8#ifndef META_OCEAN_TRACKING_POINT_CORRESPONDENCES_H
9#define META_OCEAN_TRACKING_POINT_CORRESPONDENCES_H
53 inline Correspondence(
const unsigned int index,
const unsigned int candidateIndex,
const Scalar candidateSqrDistance);
59 inline unsigned int index()
const;
65 inline unsigned int candidateIndex()
const;
71 inline Scalar candidateSqrDistance()
const;
77 explicit inline operator bool()
const;
116 inline RedundantCorrespondence(
const unsigned int index,
const unsigned int firstCandidateIndex,
const Scalar firstCandidateSqrDistance,
const unsigned int secondCandidateIndex,
const Scalar secondCandidateSqrDistance);
122 inline unsigned int secondCandidateIndex();
128 inline Scalar secondCandidateSqrDistance();
137 inline bool isUnique(
const Scalar uniquenessSqrFactor)
const;
148 inline bool isUniqueAndAccurate(
const Scalar uniquenessSqrFactor,
const Scalar maxSqrDistance)
const;
179 static inline unsigned int determineValidCorrespondences(
const HomogenousMatrix4& extrinsic,
const PinholeCamera& pinholeCamera,
const Vector3* objectPoints,
const Vector2* imagePoints,
const size_t correspondences,
const bool distortImagePoints,
const Scalar sqrPixelError =
Scalar(1.5 * 1.5),
Indices32* validCorrespondences =
nullptr);
351 correspondenceIndex((unsigned int)(-1)),
352 correspondenceCandidateIndex((unsigned int)(-1)),
353 correspondenceCandidateSqrDistance(
Numeric::maxValue())
359 correspondenceIndex(index),
360 correspondenceCandidateIndex(candidateIndex),
368 return correspondenceIndex;
373 return correspondenceCandidateIndex;
378 return correspondenceCandidateSqrDistance;
381inline PointCorrespondences::Correspondence::operator bool()
const
383 return correspondenceCandidateIndex != (
unsigned int)(-1);
388 correspondenceSecondCandidateIndex((unsigned int)(-1)),
389 correspondenceSecondCandidateSqrDistance(
Numeric::maxValue())
395 Correspondence(index, firstCandidateIndex, firstCandidateSqrDistance),
396 correspondenceSecondCandidateIndex(secondCandidateIndex),
397 correspondenceSecondCandidateSqrDistance(secondCandidateSqrDistance)
404 return correspondenceSecondCandidateIndex;
409 return correspondenceSecondCandidateSqrDistance;
414 return correspondenceCandidateIndex != (
unsigned int)(-1) && correspondenceSecondCandidateSqrDistance >= uniquenessSqrFactor * correspondenceCandidateSqrDistance;
419 return correspondenceCandidateSqrDistance <= maxSqrDistance && isUnique(uniquenessSqrFactor);
static HomogenousMatrixT4< U > standard2InvertedFlipped(const HomogenousMatrixT4< U > &world_T_camera)
Transforms a standard homogenous 4x4 viewing (extrinsic camera) matrix into an inverted and flipped c...
Definition Camera.h:778
This class implements a distribution array.
Definition SpatialDistribution.h:228
This class implements an infinite line in 2D space.
Definition Line2.h:83
This class provides basic numeric functionalities.
Definition Numeric.h:57
This class defines a correspondence object holding at most one correspondence candidate.
Definition PointCorrespondences.h:39
Scalar correspondenceCandidateSqrDistance
Candidate square distance.
Definition PointCorrespondences.h:88
unsigned int correspondenceIndex
Index of the interest point.
Definition PointCorrespondences.h:82
unsigned int index() const
Returns the index of the interest point.
Definition PointCorrespondences.h:366
Correspondence()
Creates an empty correspondence object.
Definition PointCorrespondences.h:350
unsigned int correspondenceCandidateIndex
Candidate index.
Definition PointCorrespondences.h:85
unsigned int candidateIndex() const
Returns the index of the candidate point.
Definition PointCorrespondences.h:371
Scalar candidateSqrDistance() const
Returns the square distance of the correspondence point.
Definition PointCorrespondences.h:376
This class extends the correspondence object to allow at most two correspondence candidates.
Definition PointCorrespondences.h:100
bool isUniqueAndAccurate(const Scalar uniquenessSqrFactor, const Scalar maxSqrDistance) const
Returns whether this redundant correspondence objects holds a unique and also accurate correspondence...
Definition PointCorrespondences.h:417
unsigned int correspondenceSecondCandidateIndex
Second candidate index.
Definition PointCorrespondences.h:153
Scalar correspondenceSecondCandidateSqrDistance
Second candidate square distance.
Definition PointCorrespondences.h:156
unsigned int secondCandidateIndex()
Returns the index of the second candidate point.
Definition PointCorrespondences.h:402
Scalar secondCandidateSqrDistance()
Returns the square distance of the second candidate point.
Definition PointCorrespondences.h:407
bool isUnique(const Scalar uniquenessSqrFactor) const
Returns whether this redundant correspondence object holds at least one valid correspondence candidat...
Definition PointCorrespondences.h:412
RedundantCorrespondence()
Creates an empty redundant correspondence object.
Definition PointCorrespondences.h:386
This class implements functions determining point correspondences or validates their accuracy.
Definition PointCorrespondences.h:32
std::vector< RedundantCorrespondence > RedundantCorrespondences
Definition of a vector holding redundant correspondence sets.
Definition PointCorrespondences.h:162
static RedundantCorrespondences determineNearestCandidates(const Vector2 *imagePoints, const size_t numberImagePoints, const Vector2 *candidatePoints, const size_t numberCandidatePoints, const unsigned int width, const unsigned int height, const Scalar searchWindowRadius, Indices32 *candidateUseCounter=nullptr)
Determines the nearest candidates for all given image points from an extra set of candidate image poi...
std::vector< Correspondence > Correspondences
Definition of a vector holding correspondence objects.
Definition PointCorrespondences.h:94
static RedundantCorrespondences determineNearestCandidatesIF(const HomogenousMatrix4 &invertedFlippedExtrinsic, const PinholeCamera &pinholeCamera, const Vector2 *imagePoints, const size_t numberImagePoints, const Vector3 *candidatePoints, const size_t numberCandidatePoints, const bool distortImagePoints, const Scalar searchWindowRadius, Indices32 *candidateUseCounter=nullptr)
Determines the nearest candidates for all given image points from a set of candidate object points.
static RedundantCorrespondences determineNearestCandidates(const Vector2 *imagePoints, const size_t numberImagePoints, const Vector2 *candidatePoints, const Line2 *candidateLines, const size_t numberCandidatePoints, const unsigned int width, const unsigned int height, const Scalar searchWindowRadius, const Scalar maximalLineSqrDistance, Indices32 *candidateUseCounter=nullptr)
Determines the nearest candidates for all given image points from a set of candidate image points.
static Indices32 filterValidCorrespondences(const Vector2 *firstPoints, const Vector2 *secondPoints, const size_t numberPoints, const Scalar thresholdFactor)
Finds the valid correspondences of a set of given 2D point correspondences according to the median di...
static unsigned int determineValidCorrespondencesIF(const HomogenousMatrix4 &invertedFlippedExtrinsic, const PinholeCamera &pinholeCamera, const Vector3 *objectPoints, const Vector2 *imagePoints, const size_t correspondences, const bool distortImagePoints, const Scalar sqrPixelError=Scalar(1.5 *1.5), Indices32 *validCorrespondences=nullptr)
Determines valid correspondences for a set of given object and corresponding image points combined wi...
static Indices32 filterValidCorrespondences(const Vectors2 &firstPoints, const Vectors2 &secondPoints, const Indices32 &subsetIndices, const Scalar thresholdFactor)
Finds the valid correspondences of a set of given 2D point correspondences according to the median di...
static RedundantCorrespondences determineNearestCandidates(const Vector2 *imagePoints, const size_t numberImagePoints, const Vector2 *candidatePoints, const Line2 *candidateLines, const size_t numberCandidatePoints, const Scalar searchWindowRadius, const Scalar maximalLineSqrDistance, const Geometry::SpatialDistribution::DistributionArray &distributionCandidatePoints, Indices32 *candidateUseCounter=nullptr)
Determines the nearest candidates for all given image points from a set of candidate image points.
static void removeInvalidCorrespondences(const HomogenousMatrix4 &extrinsic, const PinholeCamera &pinholeCamera, Vectors3 &objectPoints, Vectors2 &imagePoints, const bool distortImagePoints, const Scalar sqrPixelError=Scalar(1.5 *1.5))
Determines valid correspondences in a set of given object and corresponding image points.
Definition PointCorrespondences.h:427
static unsigned int determineValidCorrespondences(const HomogenousMatrix4 &extrinsic, const PinholeCamera &pinholeCamera, const Vector3 *objectPoints, const Vector2 *imagePoints, const size_t correspondences, const bool distortImagePoints, const Scalar sqrPixelError=Scalar(1.5 *1.5), Indices32 *validCorrespondences=nullptr)
Determines valid correspondences for a set of given object and corresponding image points combined wi...
Definition PointCorrespondences.h:422
static void removeInvalidCorrespondencesIF(const HomogenousMatrix4 &invertedFlippedExtrinsic, const PinholeCamera &pinholeCamera, Vectors3 &objectPoints, Vectors2 &imagePoints, const bool distortImagePoints, const Scalar sqrPixelError=Scalar(1.5 *1.5))
Determines valid correspondences in a set of given object and corresponding image points.
static RedundantCorrespondences determineNearestCandidates(const Vector2 *imagePoints, const size_t numberImagePoints, const Vector2 *candidatePoints, const size_t numberCandidatePoints, const Scalar searchWindowRadius, const Geometry::SpatialDistribution::DistributionArray &distributionCandidatePoints, Indices32 *candidateUseCounter=nullptr)
Determines the nearest candidates for all given image points from a set of candidate image points.
static RedundantCorrespondences determineNearestCandidates(const Vector2 *imagePoints, const size_t numberImagePoints, const Vector2 *candidatePoints, const size_t numberCandidatePoints, const Scalar searchWindowRadius, Indices32 *candidateUseCounter=nullptr)
Determines the nearest candidates for all given image points from an extra set of candidate image poi...
unsigned int sqrDistance(const char first, const char second)
Returns the square distance between two values.
Definition base/Utilities.h:1159
std::vector< Index32 > Indices32
Definition of a vector holding 32 bit index values.
Definition Base.h:96
std::vector< Vector2 > Vectors2
Definition of a vector holding Vector2 objects.
Definition Vector2.h:64
float Scalar
Definition of a scalar type.
Definition Math.h:129
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition Vector3.h:65
The namespace covering the entire Ocean framework.
Definition Accessor.h:15