Ocean
|
This class implements functions to estimate camera poses using template-based data types. More...
#include <PoseEstimationT.h>
Public Types | |
template<typename TDescriptor > | |
using | UnorderedDescriptorMap = std::unordered_map< Index32, TDescriptor > |
Definition of an unordered map mapping object point ids to descriptors. | |
Static Public Member Functions | |
template<typename TImagePointDescriptor , typename TObjectPointDescriptor , typename TDescriptorDistance , TDescriptorDistance(*)(const TImagePointDescriptor &, const TObjectPointDescriptor &) tImageObjectDistanceFunction> | |
static bool | determinePoseBruteForce (const AnyCamera &camera, const Vector3 *objectPoints, const TObjectPointDescriptor *objectPointDescriptors, const size_t numberObjectPoints, const Vector2 *imagePoints, const TImagePointDescriptor *imagePointDescriptors, const size_t numberImagePoints, RandomGenerator &randomGenerator, HomogenousMatrix4 &world_T_camera, const unsigned int minimalNumberCorrespondences, const TDescriptorDistance maximalDescriptorDistance, const Scalar maximalProjectionError, const Scalar inlierRate=Scalar(0.15), Indices32 *usedObjectPointIndices=nullptr, Indices32 *usedImagePointIndices=nullptr, const HomogenousMatrix4 &world_T_roughCamera=HomogenousMatrix4(false), Worker *worker=nullptr) |
Determines the 6-DOF pose for 2D/3D correspondences applying a brute-force search. | |
template<typename TImagePointDescriptor , typename TObjectPointDescriptor , typename TDescriptorDistance , TDescriptorDistance(*)(const TImagePointDescriptor &, const TObjectPointDescriptor &) tImageObjectDistanceFunction> | |
static bool | determinePoseBruteForceWithArbitraryDescriptorOrder (const AnyCamera &camera, const Vector3 *objectPoints, const TObjectPointDescriptor *objectPointDescriptors, const Index32 *objectPointIndices, const size_t numberObjectDescriptors, const Vector2 *imagePoints, const TImagePointDescriptor *imagePointDescriptors, const size_t numberImagePoints, RandomGenerator &randomGenerator, HomogenousMatrix4 &world_T_camera, const unsigned int minimalNumberCorrespondences, const TDescriptorDistance maximalDescriptorDistance, const Scalar maximalProjectionError, const Scalar inlierRate=Scalar(0.15), Indices32 *usedObjectPointIndices=nullptr, Indices32 *usedImagePointIndices=nullptr, const HomogenousMatrix4 &world_T_roughCamera=HomogenousMatrix4(false)) |
Determines the 6-DOF pose for 2D/3D correspondences applying a brute-force search. | |
template<typename TImagePointDescriptor , typename TObjectPointDescriptor , typename TDescriptorDistance , TDescriptorDistance(*)(const TImagePointDescriptor &, const TObjectPointDescriptor &) tImageObjectDistanceFunction> | |
static void | determineUnguidedBruteForceMatchings (const TObjectPointDescriptor *objectPointDescriptors, const size_t numberObjectPointDescriptors, const TImagePointDescriptor *imagePointDescriptors, const size_t numberImagePointDescriptors, TDescriptorDistance maximalDescriptorDistance, Index32 *objectPointDescriptorIndices, Worker *worker, TDescriptorDistance *distances=nullptr) |
Determines the unguided matching (without apriori information) between image point and object point features applying a brute-force search. | |
template<typename TImagePointDescriptor , typename TObjectPointDescriptor , typename TDescriptorDistance , TDescriptorDistance(*)(const TImagePointDescriptor &, const TObjectPointDescriptor &) tImageObjectDistanceFunction> | |
static void | determineGuidedBruteForceMatchings (const AnyCamera &camera, const HomogenousMatrix4 &world_T_roughCamera, const Vector3 *objectPoints, const TObjectPointDescriptor *objectPointDescriptors, const size_t numberObjectPoints, const Vector2 *imagePoints, const TImagePointDescriptor *imagePointDescriptors, const size_t numberImagePoints, TDescriptorDistance maximalDescriptorDistance, const Scalar maximalProjectionError, Index32 *objectPointDescriptorIndices, Worker *worker) |
Determines the guided matching (without known rough camera pose) between image point and object point features applying a brute-force search. | |
template<typename TImagePointDescriptor , typename TObjectPointDescriptor , typename TDescriptorDistance , TDescriptorDistance(*)(const TImagePointDescriptor &, const TObjectPointDescriptor &) tImageObjectDistanceFunction> | |
static void | determineGuidedMatchings (const AnyCamera &camera, const HomogenousMatrix4 &world_T_camera, const Vector2 *imagePoints, const TImagePointDescriptor *imagePointDescriptors, const size_t numberImagePoints, const Vector3 *objectPoints, const Geometry::Octree &objectPointOctree, const Index32 *objectPointIds, const UnorderedDescriptorMap< TObjectPointDescriptor > &objectPointDescriptorMap, Vectors2 &matchedImagePoints, Vectors3 &matchedObjectPoints, const TDescriptorDistance maximalDescriptorDistance, Indices32 *matchedImagePointIndices=nullptr, Indices32 *matchedObjectPointIds=nullptr, Worker *worker=nullptr) |
Determines the guided matching between 2D/3D correspondences. | |
template<typename TImagePointDescriptor , typename TObjectPointDescriptor , typename TDescriptorDistance , TDescriptorDistance(*)(const TImagePointDescriptor &, const TObjectPointDescriptor &) tImageObjectDistanceFunction> | |
static std::vector< TDescriptorDistance > | determineDescriptorDistances (const TObjectPointDescriptor *objectPointDescriptors, const TImagePointDescriptor *imagePointDescriptors, const Index32 *objectPointDescriptorIndices, const Index32 *imagePointDescriptorIndices, const size_t numberCorrespondences) |
Returns the individual descriptor distances for a given set of corresponding feature descriptor pairs. | |
Static Protected Member Functions | |
template<typename TImagePointDescriptor , typename TObjectPointDescriptor , typename TDescriptorDistance , TDescriptorDistance(*)(const TImagePointDescriptor &, const TObjectPointDescriptor &) tImageObjectDistanceFunction> | |
static void | determineUnguidedBruteForceMatchingsSubset (const TObjectPointDescriptor *objectPointDescriptors, const size_t numberObjectPointDescriptors, const TImagePointDescriptor *imagePointDescriptors, TDescriptorDistance maximalDescriptorDistance, Index32 *objectPointDescriptorIndices, TDescriptorDistance *distances, const unsigned int firstImagePointDescriptor, const unsigned int numberImagePointDescriptors) |
Determines the unguided matching between a subset of image point and object point features applying a brute-force search. | |
template<typename TImagePointDescriptor , typename TObjectPointDescriptor , typename TDescriptorDistance , TDescriptorDistance(*)(const TImagePointDescriptor &, const TObjectPointDescriptor &) tImageObjectDistanceFunction> | |
static void | determineGuidedBruteForceMatchingsSubset (const AnyCamera *camera, const HomogenousMatrix4 *world_T_roughCamera, const Vector3 *objectPoints, const TObjectPointDescriptor *objectPointDescriptors, const size_t numberObjectPoints, const Vector2 *imagePoints, const TImagePointDescriptor *imagePointDescriptors, TDescriptorDistance maximalDescriptorDistance, const Scalar maximalProjectionError, Index32 *objectPointDescriptorIndices, const unsigned int firstImagePoint, const unsigned int numberImagePoints) |
Determines the guided matching (without known rough camera pose) between a subset of image point and object point features applying a brute-force search. | |
template<typename TImagePointDescriptor , typename TObjectPointDescriptor , typename TDescriptorDistance , TDescriptorDistance(*)(const TImagePointDescriptor &, const TObjectPointDescriptor &) tImageObjectDistanceFunction> | |
static void | determineGuidedMatchingsSubset (const AnyCamera *camera, const HomogenousMatrix4 *world_T_camera, const Vector2 *imagePoints, const TImagePointDescriptor *imagePointDescriptors, const Vector3 *objectPoints, const Geometry::Octree *objectPointOctree, const Index32 *objectPointIds, const UnorderedDescriptorMap< TObjectPointDescriptor > *objectPointDescriptorMap, Vectors2 *matchedImagePoints, Vectors3 *matchedObjectPoints, Indices32 *matchedImagePointIndices, Indices32 *matchedObjectPointIds, const TDescriptorDistance maximalDescriptorDistance, Lock *lock, const unsigned int firstImagePoint, const unsigned int numberImagePoints) |
Determines the guided matching between 2D/3D correspondences for a subset of the given 2D image points. | |
This class implements functions to estimate camera poses using template-based data types.
using Ocean::Tracking::PoseEstimationT::UnorderedDescriptorMap = std::unordered_map<Index32, TDescriptor> |
Definition of an unordered map mapping object point ids to descriptors.
|
static |
Returns the individual descriptor distances for a given set of corresponding feature descriptor pairs.
This function can be used to e.g., analyze the distribution of descriptor distances and e.g., to determine an ideal threshold for valid descriptor correspondences.
objectPointDescriptors | The descriptors of the object points, must be valid |
imagePointDescriptors | The descriptors of the image points, must be valid |
objectPointDescriptorIndices | The indices of the object point descriptors for which a corresponding image point descriptor exists, must be valid |
imagePointDescriptorIndices | The indices of the image point descriptors for which a corresponding object point descriptor exists, one for each object point descriptor, with the same order as the object point descriptors, must be valid |
numberCorrespondences | The number of specified descriptor correspondences, with range [1, infinity) |
TImagePointDescriptor | The data type of the descriptor for the 2D image points |
TObjectPointDescriptor | The data type of the descriptor for the 3D object points |
TDescriptorDistance | The data type of the distance between image point and object point descriptors, e.g., 'uint32_t' or 'float' |
tImageObjectDistanceFunction | The function pointer to a function allowing to determine the descriptor distance between an image point feature descriptor and an object point feature descriptor, must be valid |
|
static |
Determines the guided matching (without known rough camera pose) between image point and object point features applying a brute-force search.
camera | The camera profile defining the projection, must be valid |
world_T_roughCamera | The known rough camera pose transforming camera to world, must be valid |
objectPoints | The 3D object points to be used, must be valid |
objectPointDescriptors | The object point descriptors, one for each 3D object point, must be valid |
numberObjectPoints | The number of given object points (and object point descriptors), with range [1, infinity) |
imagePoints | The 2D image points to be used, must be valid |
imagePointDescriptors | The image point descriptors, one for each 2D image point, must be valid |
numberImagePoints | The number of given image points (and image point descriptors), with range [1, infinity) |
maximalDescriptorDistance | The maximal distance between two corresponding descriptors, with range [0, infinity) |
maximalProjectionError | The maximal projection error of valid 2D/3D feature correspondences, in pixel, with range [0, infinity) |
objectPointDescriptorIndices | The resulting indices of object point descriptors matching to the individual image point descriptors, one object point descriptor index of each given image point descriptor, -1 for image point descriptors for which no matching object point descriptor could be found |
worker | Optional worker to distribute the computation |
TImagePointDescriptor | The data type of the descriptor for the 2D image points |
TObjectPointDescriptor | The data type of the descriptor for the 3D object points |
TDescriptorDistance | The data type of the distance between image point and object point descriptors, e.g., 'uint32_t' or 'float' |
tImageObjectDistanceFunction | The function pointer to a function allowing to determine the descriptor distance between an image point feature descriptor and an object point feature descriptor, must be valid |
|
staticprotected |
Determines the guided matching (without known rough camera pose) between a subset of image point and object point features applying a brute-force search.
camera | The camera profile defining the projection, must be valid |
world_T_roughCamera | The known rough camera pose transforming camera to world, must be valid |
objectPoints | The 3D object points to be used, must be valid |
objectPointDescriptors | The object point descriptors, one for each 3D object point, must be valid |
numberObjectPoints | The number of given object points (and object point descriptors), with range [1, infinity) |
imagePoints | The 2D image points to be used, must be valid |
imagePointDescriptors | The image point descriptors, one for each 2D image point, must be valid |
maximalDescriptorDistance | The maximal distance between two corresponding descriptors, with range [0, infinity) |
maximalProjectionError | The maximal projection error of valid 2D/3D feature correspondences, in pixel, with range [0, infinity) |
objectPointDescriptorIndices | The resulting indices of object point descriptors matching to the individual image point descriptors, one object point descriptor index of each given image point descriptor, -1 for image point descriptors for which no matching object point descriptor could be found |
firstImagePoint | The first image point to be handled, with range [0, numberImagePoints - 1] |
numberImagePoints | The number of image points to be handled, with range [1, numberImagePoints - firstImagePoint] |
TImagePointDescriptor | The data type of the descriptor for the 2D image points |
TObjectPointDescriptor | The data type of the descriptor for the 3D object points |
TDescriptorDistance | The data type of the distance between image point and object point descriptors, e.g., 'uint32_t' or 'float' |
tImageObjectDistanceFunction | The function pointer to a function allowing to determine the descriptor distance between an image point feature descriptor and an object point feature descriptor, must be valid |
|
static |
Determines the guided matching between 2D/3D correspondences.
camera | The camera profile to be used, must be valid |
world_T_camera | The known (rough) camera pose transforming camera to world, with default camera looking into the negative z-space an y-axis upwards, must be valid |
imagePoints | The 2D image points of all possible 2D features, must be valid |
imagePointDescriptors | The descriptors for all 2D image points, one for each image points, must be valid |
numberImagePoints | The number of 2D image points, with range [4, infinity) |
objectPoints | The 3D object points of all possible 3D features, must be valid |
objectPointOctree | The octree with all 3D object points |
objectPointIds | The ids of all 3D object points, one for each 3D object point, must be valid |
objectPointDescriptorMap | The map mapping 3D object point ids to their descriptors |
matchedImagePoints | The resulting 2D image points which have been determined during the matching |
matchedObjectPoints | The resulting 3D object points which have been determined during the matching |
maximalDescriptorDistance | The maximal descriptor distance so that two descriptors are still considered to match, with range [0, infinity) |
matchedImagePointIndices | Optional resulting indices of the image points which have been matched, one for each resulting 2D image points, nullptr if not of interest |
matchedObjectPointIds | Optional resulting object point ids of the object points which have been matched, one for each resulting 3D image points, nullptr if not of interest |
worker | Optional worker to distribute the computation |
TImagePointDescriptor | The data type of the descriptor for the 2D image points |
TObjectPointDescriptor | The data type of the descriptor for the 3D object points |
TDescriptorDistance | The data type of the distance between image point and object point descriptors, e.g., 'uint32_t' or 'float' |
tImageObjectDistanceFunction | The function pointer to a function allowing to determine the descriptor distance between an image point feature descriptor and an object point feature descriptor, must be valid |
|
staticprotected |
Determines the guided matching between 2D/3D correspondences for a subset of the given 2D image points.
camera | The camera profile to be used, must be valid |
world_T_camera | The known (rough) camera pose transforming camera to world, with default camera looking into the negative z-space an y-axis upwards, must be valid |
imagePoints | The 2D image points of all possible 2D features, must be valid |
imagePointDescriptors | The descriptors for all 2D image points, one for each image points, must be valid |
objectPoints | The 3D object points of all possible 3D features, must be valid |
objectPointOctree | The octree with all 3D object points |
objectPointIds | The ids of all 3D object points, one for each 3D object point, must be valid |
objectPointDescriptorMap | The map mapping 3D object point ids to their descriptors |
matchedImagePoints | The resulting 2D image points which have been determined during the matching |
matchedObjectPoints | The resulting 3D object points which have been determined during the matching |
maximalDescriptorDistance | The maximal descriptor distance so that two descriptors are still considered to match, with range [0, infinity) |
matchedImagePointIndices | The resulting indices of the image points which have been matched, one for each resulting 2D image points, nullptr if not of interest |
matchedObjectPointIds | The resulting object point ids of the object points which have been matched, one for each resulting 3D image points, nullptr if not of interest |
lock | The lock object in case this function is executed across multiple thread, nullptr if executed in one thread |
firstImagePoint | The index of the first image point to be handled, with range [0, numberImagePoints - 1] |
numberImagePoints | The number of image points to be handled, with range [1, numberImagePoints - firstImagePoint] |
TImagePointDescriptor | The data type of the descriptor for the 2D image points |
TObjectPointDescriptor | The data type of the descriptor for the 3D object points |
TDescriptorDistance | The data type of the distance between image point and object point descriptors, e.g., 'uint32_t' or 'float' |
tImageObjectDistanceFunction | The function pointer to a function allowing to determine the descriptor distance between an image point feature descriptor and an object point feature descriptor, must be valid |
|
static |
Determines the 6-DOF pose for 2D/3D correspondences applying a brute-force search.
The function can be used to verify the performance/correctness of pose estimation functions avoiding a brute-force search.
camera | The camera profile to be used, must be valid |
objectPoints | The 3D object points of all possible 3D features, must be valid |
objectPointDescriptors | The descriptors for all 3D object points, one descriptor for each 3D object point (however, TObjectPointDescriptor allows to e.g., define a array/vector of several descriptors per object point), must be valid |
numberObjectPoints | The number of given 3D object points (and object point descriptors), with range [4, infinity) |
imagePoints | The 2D image points of all possible 2D features, must be valid |
imagePointDescriptors | The descriptors for all 2D image points, one for each image points, must be valid |
numberImagePoints | The number of 2D image points, with range [4, infinity) |
randomGenerator | The random generator to be used |
world_T_camera | The resulting camera pose transforming camera to world, with default camera looking into the negative z-space an y-axis upwards |
minimalNumberCorrespondences | The minimal number of 2D/3D correspondences so that a camera pose counts as valid, with range [4, infinity) |
maximalDescriptorDistance | The maximal descriptor distance so that two descriptors are still considered to match, with range [0, infinity) |
maximalProjectionError | The maximal projection error between a projected 3D object point and a 2D image point so that both points count as corresponding, in pixel, with range [0, infinity) |
inlierRate | The rate of correspondence inliers within the entire set of correspondences, e.g., 0.15 means that 15% of matched features are correct and can be used to determine a valid pose, with range (0, 1] |
usedObjectPointIndices | Optional resulting indices of the 3D object points which have been used to determine the camera pose, nullptr if not of interest |
usedImagePointIndices | Optional resulting indices of the 2D image points which have been used to determine the camera pose, nullptr if not of interest |
world_T_roughCamera | Optional known rough camera pose allowing to skip the unguided matching, invalid if unknown |
worker | Optional worker to distribute the computation |
TImagePointDescriptor | The data type of the descriptor for the 2D image points |
TObjectPointDescriptor | The data type of the descriptor for the 3D object points |
TDescriptorDistance | The data type of the distance between image point and object point descriptors, e.g., 'uint32_t' or 'float' |
tImageObjectDistanceFunction | The function pointer to a function allowing to determine the descriptor distance between an image point feature descriptor and an object point feature descriptor, must be valid |
|
static |
Determines the 6-DOF pose for 2D/3D correspondences applying a brute-force search.
The function can be used to verify the performance/correctness of pose estimation functions avoiding a brute-force search. This function uses descriptors for 3D object points which can be stored in an arbitrary order (even multiple individual descriptors can exist for one 3D object point). The relationship between object point descriptors and their corresponding 3D object point locations is defined via 'objectPointIndices'.
camera | The camera profile to be used, must be valid |
objectPoints | The 3D object points of all possible 3D features, must be valid |
objectPointDescriptors | The descriptors for all 3D object points, some descriptors may describe the same 3D object points (e.g., because of different viewing locations), must be valid |
objectPointIndices | The indices of the corresponding 3D object points, one for each object point descriptor, mainly a map mapping descriptor indices to point indices, must be valid |
numberObjectDescriptors | The number of given descriptors for the 3D object points, with range [4, infinity) |
imagePoints | The 2D image points of all possible 2D features, must be valid |
imagePointDescriptors | The descriptors for all 2D image points, one for each image points, must be valid |
numberImagePoints | The number of 2D image points, with range [4, infinity) |
randomGenerator | The random generator to be used |
world_T_camera | The resulting camera pose transforming camera to world, with default camera looking into the negative z-space an y-axis upwards |
minimalNumberCorrespondences | The minimal number of 2D/3D correspondences so that a camera pose counts as valid, with range [4, infinity) |
maximalDescriptorDistance | The maximal descriptor distance so that two descriptors are still considered to match, with range [0, infinity) |
maximalProjectionError | The maximal projection error between a projected 3D object point and a 2D image point so that both points count as corresponding, in pixel, with range [0, infinity) |
inlierRate | The rate of correspondence inliers within the entire set of correspondences, e.g., 0.15 means that 15% of matched features are correct and can be used to determine a valid pose, with range (0, 1] |
usedObjectPointIndices | Optional resulting indices of the 3D object points which have been used to determine the camera pose, nullptr if not of interest |
usedImagePointIndices | Optional resulting indices of the 2D image points which have been used to determine the camera pose, nullptr if not of interest |
world_T_roughCamera | Optional known rough camera pose allowing to skip the unguided matching, invalid if unknown |
TImagePointDescriptor | The data type of the descriptor for the 2D image points |
TObjectPointDescriptor | The data type of the descriptor for the 3D object points |
TDescriptorDistance | The data type of the distance between image point and object point descriptors, e.g., 'uint32_t' or 'float' |
tImageObjectDistanceFunction | The function pointer to a function allowing to determine the descriptor distance between an image point feature descriptor and an object point feature descriptor, must be valid |
|
static |
Determines the unguided matching (without apriori information) between image point and object point features applying a brute-force search.
objectPointDescriptors | The object point descriptors to be used, must be valid |
numberObjectPointDescriptors | The number of given object point descriptors, with range [1, infinity) |
imagePointDescriptors | The image point descriptors to be used, must be valid |
numberImagePointDescriptors | The number of given image point descriptors, with range [1, infinity) |
maximalDescriptorDistance | The maximal distance between two corresponding descriptors, with range [0, infinity) |
objectPointDescriptorIndices | The resulting indices of object point descriptors matching to the individual image point descriptors, one object point descriptor index of each given image point descriptor, -1 for image point descriptors for which no matching object point descriptor could be found |
worker | Optional worker to distribute the computation |
distances | Optional resulting distances between the individual matched descriptors, one for each image point descriptor, undefined if no matching exists, nullptr if not of interest |
TImagePointDescriptor | The data type of the descriptor for the 2D image points |
TObjectPointDescriptor | The data type of the descriptor for the 3D object points |
TDescriptorDistance | The data type of the distance between image point and object point descriptors, e.g., 'uint32_t' or 'float' |
tImageObjectDistanceFunction | The function pointer to a function allowing to determine the descriptor distance between an image point feature descriptor and an object point feature descriptor, must be valid |
|
staticprotected |
Determines the unguided matching between a subset of image point and object point features applying a brute-force search.
objectPointDescriptors | The object point descriptors to be used, must be valid |
numberObjectPointDescriptors | The number of given object point descriptors, with range [1, infinity) |
imagePointDescriptors | The image point descriptors to be used, must be valid |
maximalDescriptorDistance | The maximal distance between two corresponding descriptors, with range [0, infinity) |
objectPointDescriptorIndices | The resulting indices of object point descriptors matching to the individual image point descriptors, one object point descriptor index of each given image point descriptor, -1 for image point descriptors for which no matching object point descriptor could be found |
distances | Optional resulting distances between the individual matched descriptors, one for each image point descriptor, nullptr if not of interest |
firstImagePointDescriptor | The first image point descriptor to be handled, with range [0, numberImagePointDescriptors - 1] |
numberImagePointDescriptors | The number of image point descriptors to be handled, with range [1, numberImagePointDescriptors - firstImagePointDescriptor] |
TImagePointDescriptor | The data type of the descriptor for the 2D image points |
TObjectPointDescriptor | The data type of the descriptor for the 3D object points |
TDescriptorDistance | The data type of the distance between image point and object point descriptors, e.g., 'uint32_t' or 'float' |
tImageObjectDistanceFunction | The function pointer to a function allowing to determine the descriptor distance between an image point feature descriptor and an object point feature descriptor, must be valid |