Ocean
Ocean::Geometry::TLinkage Class Reference

This class implements L-linkage functions for pose/homography determination. More...

Inheritance diagram for Ocean::Geometry::TLinkage:

Static Public Member Functions

static bool homographyMatrices (const ImagePoint *leftImagePoints, const ImagePoint *rightImagePoints, const size_t correspondences, SquareMatrices3 &homographies, const unsigned int testCandidates, const ImagePoints &leftPointForInitialModels, const Scalar pixelAssignmentRadius, std::vector< IndexSet32 > *usedIndicesPerHomography=nullptr, bool refineHomographies=true, Ocean::RandomGenerator *randomGenerator=nullptr)
 Calculates multiple homographies between two images transforming the projected planar object points between the two images using T-linkage The resulting homographies transform its image points defined in the left image to image points defined in the right image (rightPoint_i = H_i * leftPoint_i). More...
 
static bool fitLines (const ImagePoint *imagePoints, const size_t pointCount, Lines2 &lines, const unsigned int testCandidates, const ImagePoints &pointForInitialModels, const Scalar pixelErrorAssignmentThreshold, std::vector< IndexSet32 > *usedIndicesPerHomography=nullptr)
 Multiple line detector using T-linkage. More...
 

Static Private Member Functions

static Scalar tanimotoDistance (const Matrix &vectorA, const Matrix &vectorB)
 Calculates the tanimoto distance d(A, B) = 1 - A*B / (A*A + B*B - A*B). More...
 
- Static Private Member Functions inherited from Ocean::Geometry::JLinkage
static bool homographyMatrices (const ImagePoint *leftImagePoints, const ImagePoint *rightImagePoints, const size_t correspondences, const unsigned int width, const unsigned int height, SquareMatrices3 &homographies, const unsigned int testCandidates, const ImagePoints &leftPointForInitialModels, const Scalar squarePixelErrorAssignmentThreshold, std::vector< IndexSet32 > *usedIndicesPerHomography=nullptr, bool refineHomographies=true, bool approximatedNeighborSearch=true, Ocean::RandomGenerator *randomGenerator=nullptr)
 Calculates multiple homographies between two images transforming the projected planar object points between the two images using J-linkage The resulting homographies transform its image points defined in the left image to image points defined in the right image (rightPoint_i = H_i * leftPoint_i). More...
 
static bool homographyMatrices (const ImagePoint *leftImagePoints, const ImagePoint *rightImagePoints, const size_t correspondences, const unsigned int width, const unsigned int height, SquareMatrices3 &homographies, const unsigned int testCandidates, const Indices32 &leftPointIndicesForInitialModels, const Scalar squarePixelErrorAssignmentThreshold, std::vector< IndexSet32 > *usedIndicesPerHomography=nullptr, bool refineHomographies=true, bool approximatedNeighborSearch=true, Ocean::RandomGenerator *randomGenerator=nullptr)
 Calculates multiple homographies between two images transforming the projected planar object points between the two images using J-linkage The resulting homographies transform its image points defined in the left image to image points defined in the right image (rightPoint_i = H_i * leftPoint_i). More...
 
static bool fitLines (const ImagePoint *imagePoints, const size_t pointCount, const unsigned int width, const unsigned int height, Lines2 &lines, const unsigned int testCandidates, const ImagePoints &pointForInitialModels, const Scalar pixelErrorAssignmentThreshold, std::vector< IndexSet32 > *usedIndicesPerHomography=nullptr, bool approximatedNeighborSearch=true)
 Multiple line detector using J-linkage. More...
 
static std::vector< Indices32buildingMinimalSampleSet (const ImagePoint *imagePoints, const size_t pointCount, const ImagePoints &pointForInitialModels, const unsigned int testCandidates, const SpatialDistribution::DistributionArray *distributionImagePoints=nullptr)
 Generates minimal sample set for J-/T-Linkage. More...
 
static SquareMatrices3 buildingMinimalSampleSetHomography (const ImagePoint *leftImagePoints, const ImagePoint *rightImagePoints, const size_t correspondences, const ImagePoints &leftPointForInitialModels, const unsigned int testCandidates, const SpatialDistribution::DistributionArray *distributionImagePoints=nullptr, RandomGenerator *randomRansac=nullptr)
 Generates a homography per minimal sample set (for J-/T-Linkage) More...
 
static Lines2 buildingMinimalSampleSetLine (const ImagePoint *imagePoints, const size_t pointCount, const ImagePoints &pointForInitialModels, const unsigned int testCandidates, const SpatialDistribution::DistributionArray *distributionImagePoints=nullptr)
 Generates a line model per minimal sample set (for J-/T-Linkage) More...
 
static Scalar jaccardDistance (const IndexSet32 &setA, const IndexSet32 &setB)
 Calculates the jaccard distance d(A, B) = ( |union(A, B)| - |intersection(A, B)| ) / |union(A, B)|. More...
 
static bool distancePairSortAscending (const DistancePair &firstPair, const DistancePair &seccondPair)
 Sorts pairs of indices and their corresponding distances in ascending order regarding the distance values. More...
 

Additional Inherited Members

- Private Types inherited from Ocean::Geometry::JLinkage
typedef std::pair< Scalar, Index32DistancePair
 Definition of a pair combining a point index with the distance to a reference. More...
 

Detailed Description

This class implements L-linkage functions for pose/homography determination.

T-linkage aims to fit multiple models from data given The T-linkage algorithm is an agglomerative clustering that proceeds by linking elements with tanimoto distance smaller than 1 and stop as soon as there are no such elements left.

Member Function Documentation

◆ fitLines()

static bool Ocean::Geometry::TLinkage::fitLines ( const ImagePoint imagePoints,
const size_t  pointCount,
Lines2 lines,
const unsigned int  testCandidates,
const ImagePoints pointForInitialModels,
const Scalar  pixelErrorAssignmentThreshold,
std::vector< IndexSet32 > *  usedIndicesPerHomography = nullptr 
)
static

Multiple line detector using T-linkage.

Parameters
imagePointsimage points
pointCountNumber of points
linesResulting valid line model
testCandidatesNumber of candidates used in for minimum sample set, with range [2, correspondences]
pointForInitialModelsInitial image points, one per each sample set
pixelErrorAssignmentThresholdMaximal pixel error of a point-line corresspodance (0, infinity)
usedIndicesPerHomographyOptional set of indices which will receive the indices of the used image correspondences per model, if defined
Returns
True, if successfully completed

◆ homographyMatrices()

static bool Ocean::Geometry::TLinkage::homographyMatrices ( const ImagePoint leftImagePoints,
const ImagePoint rightImagePoints,
const size_t  correspondences,
SquareMatrices3 homographies,
const unsigned int  testCandidates,
const ImagePoints leftPointForInitialModels,
const Scalar  pixelAssignmentRadius,
std::vector< IndexSet32 > *  usedIndicesPerHomography = nullptr,
bool  refineHomographies = true,
Ocean::RandomGenerator randomGenerator = nullptr 
)
static

Calculates multiple homographies between two images transforming the projected planar object points between the two images using T-linkage The resulting homographies transform its image points defined in the left image to image points defined in the right image (rightPoint_i = H_i * leftPoint_i).


Parameters
leftImagePointsImage points in the left camera, each point corresponds to one point in the right image
rightImagePointsImage points in the right camera
correspondencesNumber of points correspondences
homographiesResulting valid homographies for each image plane
testCandidatesNumber of candidates used in for minimum sample set, with range [8, correspondences]
leftPointForInitialModelsInitial image points, one per each sample set
pixelAssignmentRadiusMaximal pixel radius of image points being considered [5, image width)
usedIndicesPerHomographyOptional set of indices which will receive the indices of the used image correspondences per model, if defined
refineHomographiesDetermines whether a not linear least square algorithm is used to increase the pose accuracies after J-linkage
randomGeneratorRandom number generator. If is not nullptr, RANSAC is used for homography refinement
Returns
True, if successfully completed

◆ tanimotoDistance()

Scalar Ocean::Geometry::TLinkage::tanimotoDistance ( const Matrix vectorA,
const Matrix vectorB 
)
inlinestaticprivate

Calculates the tanimoto distance d(A, B) = 1 - A*B / (A*A + B*B - A*B).


A and B must have the same amount of elements

Parameters
vectorAfirst vector to compare
vectorBsecond vector to compare
Returns
Tanimoto distance [0, 1]

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