8 #ifndef META_OCEAN_TRACKING_MAPBUILDING_UNIFIED_POSE_ESTIMATION_H
9 #define META_OCEAN_TRACKING_MAPBUILDING_UNIFIED_POSE_ESTIMATION_H
75 bool determinePose(
const AnyCamera& camera,
const UnifiedDescriptors& imagePointDescriptors,
const Vector2* imagePoints,
RandomGenerator& randomGenerator,
HomogenousMatrix4& world_T_camera,
const unsigned int minimalNumberCorrespondences,
const UnifiedMatching::DistanceValue& maximalDescriptorDistance,
const Scalar maximalProjectionError,
const Scalar inlierRate,
Indices32* usedObjectPointIndices =
nullptr,
Indices32* usedImagePointIndices =
nullptr,
const HomogenousMatrix4& world_T_roughCamera =
HomogenousMatrix4(
false),
Worker* worker =
nullptr)
const;
90 template <
typename TDescriptorA,
typename TDescriptorB,
typename TDescriptorDistance, TDescriptorDistance(*tDescriptorDistanceFunction)(const TDescriptorA&, const TDescriptorB&)>
91 static void determineBruteForceMatchings(
const TDescriptorA* descriptorsA,
const size_t numberDescriptorsA,
const TDescriptorB* descriptorsB,
const size_t numberDescriptorsB,
const TDescriptorDistance maximalDescriptorDistance,
Indices32& indicesA,
Indices32& indicesB, std::vector<double>* distances =
nullptr,
Worker* worker =
nullptr);
95 template <
typename TUnifiedDescriptorsA,
typename TUnifiedDescriptorsB,
typename TDescriptorDistance>
113 template <
typename T>
142 template <
typename TDescriptorA,
typename TDescriptorB,
typename TDescriptorDistance, TDescriptorDistance(*tDescriptorDistanceFunction)(const TDescriptorA&, const TDescriptorB&)>
145 ocean_assert(descriptorsA !=
nullptr);
146 ocean_assert(numberDescriptorsA != 0);
148 ocean_assert(descriptorsB !=
nullptr);
149 ocean_assert(numberDescriptorsB != 0);
151 Indices32 indicesB2A(numberDescriptorsB);
152 Indices32 floatDistances(numberDescriptorsB);
154 PoseEstimationT::determineUnguidedBruteForceMatchings<TDescriptorA, TDescriptorB, TDescriptorDistance, tDescriptorDistanceFunction>(descriptorsA, numberDescriptorsA, descriptorsB, numberDescriptorsB, maximalDescriptorDistance, indicesB2A.data(), worker);
156 for (
size_t n = 0; n < indicesB2A.size(); ++n)
158 const Index32& indexA = indicesB2A[n];
162 indicesA.emplace_back(indexA);
163 indicesB.emplace_back(
Index32(n));
165 if (distances !=
nullptr)
167 distances->emplace_back(
double(floatDistances[n]));
This class implements the abstract base class for all AnyCamera objects.
Definition: AnyCamera.h:130
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
This class implements a brute-force pose estimation for unified data types.
Definition: UnifiedPoseEstimation.h:29
const Indices32 & objectPointIds() const
Returns the ids of all 3D object points.
Definition: UnifiedPoseEstimation.h:135
static bool determineBruteForceMatchings(const UnifiedDescriptors &descriptorsA, const UnifiedDescriptors &descriptorsB, const TDescriptorDistance maximalDescriptorDistance, Indices32 &indicesA, Indices32 &indicesB, std::vector< double > *distances=nullptr, Worker *worker=nullptr)
static SharedUnifiedDescriptors extractObjectPointDescriptors(const UnifiedDescriptorMap &unifiedDescriptorMap, const Indices32 &objectPointIds)
Extracts serialized descriptors from a descriptor map.
UnifiedBruteForcePoseEstimation(const ObjectPointMap &objectPointMap, const UnifiedDescriptorMap &unifiedDescriptorMap)
Creates a new pose estimation object.
bool determinePose(const AnyCamera &camera, const UnifiedDescriptors &imagePointDescriptors, const Vector2 *imagePoints, RandomGenerator &randomGenerator, HomogenousMatrix4 &world_T_camera, const unsigned int minimalNumberCorrespondences, const UnifiedMatching::DistanceValue &maximalDescriptorDistance, const Scalar maximalProjectionError, const Scalar inlierRate, Indices32 *usedObjectPointIndices=nullptr, Indices32 *usedImagePointIndices=nullptr, const HomogenousMatrix4 &world_T_roughCamera=HomogenousMatrix4(false), Worker *worker=nullptr) const
Determines the camera pose based on several image points and their descriptors.
static bool determineBruteForceMatchings(const UnifiedDescriptors &descriptorsA, const UnifiedDescriptors &descriptorsB, const UnifiedMatching::DistanceValue &maximalDescriptorDistance, Indices32 &indicesA, Indices32 &indicesB, std::vector< double > *distances=nullptr, Worker *worker=nullptr)
Determines the brute-force matching between two sets of feature descriptors.
SharedUnifiedDescriptors objectPointDescriptors_
The descriptors of the 3D object point in sequential order (same order as the 3D object points),...
Definition: UnifiedPoseEstimation.h:125
const Vectors3 & objectPoints() const
Returns all 3D object points which are used for pose estimation.
Definition: UnifiedPoseEstimation.h:128
Indices32 objectPointIds_
The ids of all 3D object points, one for each object point.
Definition: UnifiedPoseEstimation.h:122
static SharedUnifiedDescriptors extractObjectPointDescriptors(const T &unifiedDescriptorMap, const Indices32 &objectPointIds)
Extracts serialized descriptors from a descriptor map.
Vectors3 objectPoints_
The 3D object points which will be used for pose estimation.
Definition: UnifiedPoseEstimation.h:119
std::unordered_map< unsigned int, Vector3 > ObjectPointMap
Definition of an unordered map mapping object point ids to 3D object point locations.
Definition: UnifiedPoseEstimation.h:35
This class implements the base class for all unified descriptor maps in which ids are mapped to descr...
Definition: UnifiedDescriptorMap.h:38
This class implements the base class for all unified descriptor buffers stored in a continuous memory...
Definition: UnifiedDescriptors.h:29
Definition of a descriptor distance value.
Definition: UnifiedMatching.h:52
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
std::vector< Index32 > Indices32
Definition of a vector holding 32 bit index values.
Definition: Base.h:96
uint32_t Index32
Definition of a 32 bit index value.
Definition: Base.h:84
float Scalar
Definition of a scalar type.
Definition: Math.h:128
HomogenousMatrixT4< Scalar > HomogenousMatrix4
Definition of the HomogenousMatrix4 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION flag eit...
Definition: HomogenousMatrix4.h:37
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition: Vector3.h:65
std::shared_ptr< UnifiedDescriptors > SharedUnifiedDescriptors
Definition of a shared pointer holding a UnifiedDescriptors object.
Definition: UnifiedDescriptors.h:63
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15