Ocean
Loading...
Searching...
No Matches
slam/TrackerMono.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_TRACKING_SLAM_TRACKER_MONO_H
9#define META_OCEAN_TRACKING_SLAM_TRACKER_MONO_H
10
24
25#include "ocean/base/Frame.h"
28#include "ocean/base/Thread.h"
29
31
35
36namespace Ocean
37{
38
39namespace Tracking
40{
41
42namespace SLAM
43{
44
45/**
46 * This class implements a monocular SLAM tracker.
47 * @ingroup trackingslam
48 */
49class OCEAN_TRACKING_SLAM_EXPORT TrackerMono :
50 public Tracker,
51 protected Thread
52{
53 public:
54
55 /**
56 * This class holds per-frame tracking statistics for debugging and analysis.
57 * Statistics include tracking counts, pose estimation data, projection errors, and the resulting camera pose.
58 */
60 {
61 public:
62
63 /**
64 * Creates a new frame statistics object for a specific frame.
65 * @param frameIndex The index of the frame, with range [0, infinity)
66 */
67 explicit inline FrameStatistics(const Index32 frameIndex);
68
69 /**
70 * Returns whether the frame statistics contain valid data.
71 * @return True if valid; false otherwise
72 */
73 bool isValid() const;
74
75 public:
76
77 /// The index of the frame these statistics belong to.
78 Index32 frameIndex_ = Index32(-1);
79
80 /// The number of feature points that could potentially be tracked from the previous frame.
81 size_t frameToFrameTrackingPossible_ = 0;
82
83 /// The number of feature points that were actually tracked successfully from the previous frame.
84 size_t frameToFrameTrackingActual_ = 0;
85
86 /// The number of 2D-3D correspondences used for pose estimation.
87 size_t poseEstimationCorrespondences_ = 0;
88
89 /// The average projection error of the estimated pose, negative if not computed.
90 Scalar projectionError_ = Scalar(-1);
91
92 /// The estimated camera pose, invalid if pose estimation failed.
93 HomogenousMatrix4 world_T_camera_ = HomogenousMatrix4(false);
94
95 /// The map version at the time of pose estimation.
96 unsigned int mapVersion_ = 0u;
97 };
98
99 /// Definition of a vector holding frame statistics.
100 using FramesStatistics = std::vector<FrameStatistics>;
101
102 protected:
103
104 /**
105 * Background object:
106 *
107 * This class implements an optimization for 3D object points that were not included in the main Bundle Adjustment.
108 * The class collects object points visible in at least two keyframes and optimizes their 3D positions using non-linear optimization with the already-optimized camera poses from Bundle Adjustment.
109 * @note The keyFrameIndices reference must remain valid for the lifetime of this object.
110 */
112 {
113 protected:
114
115 /**
116 * This class holds data for a single object point to be optimized.
117 */
119 {
120 public:
121
122 /// The 3D position of the object point.
124
125 /// The indices into the keyframe subset where this object point is observed.
126 std::vector<size_t> keyFrameSubsetIndices_;
127
128 /// The 2D image point observations corresponding to keyFrameSubsetIndices_.
130 };
131
132 /// Definition of a map mapping object point ids to their optimization data.
133 using OptimizationObjectMap = std::unordered_map<Index32, OptimizationObject>;
134
135 public:
136
137 /**
138 * Creates a new object point optimization object.
139 * @param keyFrameIndices The indices of keyframes to consider for optimization, must remain valid for the lifetime of this object
140 */
141 explicit inline ObjectPointOptimization(const Indices32& keyFrameIndices);
142
143 /**
144 * Collects object points that are visible in at least one keyframe and were not part of the previous Bundle Adjustment.
145 * For each collected object point, the function gathers all 2D observations across the keyframes.
146 * @param localizedObjectPointMap The map of all localized 3D object points with their observations
147 * @param previousBundleAdjustmentObjectPointIdSet The set of object point ids that were already optimized in Bundle Adjustment
148 */
149 void collectObjectPoints(const LocalizedObjectPointMap& localizedObjectPointMap, const UnorderedIndexSet32& previousBundleAdjustmentObjectPointIdSet);
150
151 /**
152 * Optimizes the collected object points using non-linear optimization with fixed camera poses.
153 * Object points visible in at least two keyframes are optimized. Successfully optimized points (with projection error below threshold) are added to the output vectors; others are marked as inaccurate.
154 * @param camera The camera profile used for projection, must be valid
155 * @param optimizedFlippedCameras_T_world The optimized flipped camera poses from Bundle Adjustment, one for each keyframe
156 * @param estimatorType The robust estimator type to use for optimization
157 * @param maximalProjectionError The maximum allowed projection error for a point to be considered accurate, in pixels
158 * @param currentBundleAdjustmentObjectPointIdSet The set of object point ids from Bundle Adjustment, will be extended with newly optimized points
159 * @param currentObjectPointIds The vector of optimized object point ids, will be extended with newly optimized points
160 * @param currentObjectPointPositions The vector of optimized object point positions, will be extended with newly optimized points
161 * @param inaccurateObjectPointIds The resulting ids of object points that could not be optimized accurately
162 */
163 void optimizeObjectPointsIF(const AnyCamera& camera, const HomogenousMatrices4& optimizedFlippedCameras_T_world, const Geometry::Estimator::EstimatorType estimatorType, const Scalar maximalProjectionError, UnorderedIndexSet32& currentBundleAdjustmentObjectPointIdSet, Indices32& currentObjectPointIds, Vectors3& currentObjectPointPositions, Indices32& inaccurateObjectPointIds);
164
165 protected:
166
167 /// Reference to the keyframe indices to consider for optimization.
169
170 /// The map of object points to be optimized.
172 };
173
174 /**
175 * Definition of a pair combining a frame index with a 2D observation.
176 */
177 using PoseIndexToImagePointPair = std::pair<unsigned int, Vector2>;
178
179 /**
180 * Definition of a vector holding pairs of frame indices and 2D observations.
181 */
182 using PoseIndexToImagePointPairs = std::vector<PoseIndexToImagePointPair>;
183
184 /**
185 * Definition of an unordered map mapping object point ids to observation pairs.
186 */
187 using ObjectPointToObservations = std::unordered_map<Index32, PoseIndexToImagePointPairs>;
188
189 /**
190 * This class encapsulates all performance measurement logic for the TrackerMono.
191 * The class can be enabled or disabled at compile time via the isEnabled_ flag.<br>
192 * When disabled, all performance measurements become no-ops.
193 */
195 {
196 public:
197
198 /// True, to enable performance measurements; False, to disable.
199 static constexpr bool isEnabled_ = true;
200
201 /**
202 * This class defines a scoped high performance statistic module.
203 * When isEnabled_ is false, this becomes a no-op.
204 */
206 {
207 public:
208
209 /**
210 * Creates a new scoped statistic object and starts a new measurement.
211 * @param statistic The specific statistic to measure
212 */
213 inline explicit ScopedStatistic(HighPerformanceStatistic& statistic);
214
215 /**
216 * Destructs a scoped statistic object and stops the measurement.
217 */
218 inline ~ScopedStatistic();
219
220 protected:
221
222 /**
223 * Disabled copy constructor.
224 */
226
227 protected:
228
229 /// Pointer to the statistic object, nullptr if disabled.
230 HighPerformanceStatistic* statistic_ = nullptr;
231 };
232
233 /**
234 * Starts a specific performance measurement.
235 * @param statistic The statistic to start
236 */
237 inline void start(HighPerformanceStatistic& statistic) const;
238
239 /**
240 * Stops a specific performance measurement.
241 * @param statistic The statistic to stop
242 */
243 inline void stop(HighPerformanceStatistic& statistic) const;
244
245 /**
246 * Returns a string with the relevant performance information.
247 * @return The formatted performance report
248 */
249 std::string toString() const;
250
251 public:
252
253 /// Performance statistic for the handleFrame() function.
255
256 /// Performance statistic for tracking image points.
258
259 /// Performance statistic for updating the tracking database.
261
262 /// Performance statistic for determining the camera pose.
264
265 /// Performance statistic for optimizing bad object points.
267
268 /// Performance statistic for determining initial object points.
270
271 /// Performance statistic for re-localization.
273
274 /// Performance statistic for Bundle Adjustment.
276
277 /// Performance statistic for detecting new image points.
279
280 /// Performance statistic for matching unlocalized object points.
282
283 /// Performance statistic for matching unlocalized object points.
285 };
286
287 /**
288 * Definition of a pair combining object point ids and object point positions.
289 */
290 using ObjectPointIdPositionPair = std::pair<Index32, Vector3>;
291
292 /**
293 * Definition of a vector holding object point id and position pairs.
294 */
295 using ObjectPointIdPositionPairs = std::vector<ObjectPointIdPositionPair>;
296
297 public:
298
299
300 /**
301 * This class holds debug data for visualization and analysis purposes.
302 * The class maintains 2D point tracks across frames and their associated 3D object points.
303 */
304 class OCEAN_TRACKING_SLAM_EXPORT DebugData
305 {
306 public:
307
308 /// Definition of a pair combining the last frame index with a sequence of 2D image points.
309 using TrackPair = std::pair<Index32, Vectors2>;
310
311 /// Definition of a map mapping object point ids to their track data.
312 using TracksMap = std::unordered_map<Index32, TrackPair>;
313
314 /**
315 * This class holds information about a 3D object point for visualization purposes.
316 */
317 class Point
318 {
319 public:
320
321 /**
322 * Creates a default point object.
323 */
324 Point() = default;
325
326 /**
327 * Creates a new point object.
328 * @param position The 3D position of the object point
329 * @param precision The localization precision of the object point
330 */
331 inline Point(const Vector3& position, const LocalizedObjectPoint::LocalizationPrecision precision);
332
333 public:
334
335 /// The 3D position of the object point.
336 Vector3 position_ = Vector3::minValue();
337
338 /// The localization precision of the object point.
339 LocalizedObjectPoint::LocalizationPrecision precision_ = LocalizedObjectPoint::LP_INVALID;
340
341 /// True if this object point has been optimized by Bundle Adjustment.
342 bool isBundleAdjusted_ = false;
343 };
344
345 /// Definition of a map mapping object point ids to their 3D positions and precisions.
346 using PointMap = std::unordered_map<Index32, Point>;
347
348 public:
349
350 /**
351 * Updates the tracking data with new frame correspondences.
352 * This function updates 2D tracks with new observations and removes invalid tracks.
353 * @param frameIndex The index of the current frame, with range [0, infinity)
354 * @param trackingCorrespondences The tracking correspondences containing point ids and image points
355 * @param poseCorrespondences The pose correspondences containing 3D object points and outlier information
356 */
357 void update(const Index32 frameIndex, const TrackingCorrespondences& trackingCorrespondences, const PoseCorrespondences& poseCorrespondences);
358
359 /**
360 * Updates the debug data by merging from another DebugData object.
361 * The tracksMap is replaced entirely while pointMap entries are merged.
362 * Object points marked as inaccurate in the source are removed from pointMap.
363 * @param debugData The source debug data to merge from, will be moved
364 */
365 void update(DebugData&& debugData);
366
367 /**
368 * Clears all debug data.
369 * Resets the object to its initial empty state.
370 */
371 void clear();
372
373 public:
374
375 /// The map of 2D point tracks, mapping object point ids to their last frame index and sequence of 2D observations.
377
378 /// The map of 3D object points, mapping object point ids to their 3D positions and localization precisions.
380
381 /// The set of object point ids with precise localization used for pose estimation.
383
384 /// The set of object point ids with imprecise localization used for pose estimation.
386
387 /// The set of object point ids that were identified as outliers during pose estimation.
389 };
390
391 /**
392 * Creates a new tracker object.
393 */
395
396 /**
397 * Destructs this tracker object.
398 */
399 ~TrackerMono() override;
400
401 /**
402 * Configures the tracker with the specified settings.
403 * This function must be called before the first frame is processed.
404 * @param configuration The configuration object containing all tracker settings, must be valid
405 * @return True if configuration was successful
406 */
407 bool configure(const Configuration& configuration);
408
409 /**
410 * Processes a new camera frame and determines the camera pose.
411 * This is the main entry point for the tracker. The function tracks feature points from the previous frame, estimates the 6-DOF camera pose, and triggers background processing for map maintenance.<br>
412 * The tracker transitions from TS_INITIALIZING to TS_TRACKING once sufficient object points are tracked with adequate quality.
413 * @param camera The camera profile defining the projection, must be valid and consistent across all frames
414 * @param yFrame The current grayscale frame (FORMAT_Y8), will be moved, must be valid with matching dimensions
415 * @param world_T_camera The resulting camera pose transforming camera to world coordinates, invalid if pose could not be determined
416 * @param cameraGravity Optional gravity vector in camera coordinates (unit vector), can be null if unavailable
417 * @param anyWorld_Q_camera Optional orientation from an external source (e.g., IMU), can be invalid if unavailable
418 * @param debugData Optional pointer to receive debug data for visualization/analysis, nullptr to skip
419 * @return True if the frame was processed successfully; false on error
420 */
421 bool handleFrame(const AnyCamera& camera, Frame&& yFrame, HomogenousMatrix4& world_T_camera, const Vector3& cameraGravity = Vector3(0, 0, 0), const Quaternion& anyWorld_Q_camera = Quaternion(false), DebugData* debugData = nullptr);
422
423 /**
424 * Returns the index of the current frame which the tracker has just processed.
425 * @return The tracker's current frame index, with range [0, infinity)
426 */
427 inline Index32 frameIndex() const;
428
429 /**
430 * Returns a string with performance statistics for the tracker.
431 * Call only after the tracker has finished.
432 * @return The performance statistics as a formatted string
433 */
434 std::string performance() const;
435
436 /**
437 * Returns the collected per-frame statistics.
438 * Call only after the tracker has finished.
439 * @return The vector of frame statistics
440 */
442
443 protected:
444
445 /**
446 * Checks whether frame statistics collection is enabled and retrieves a pointer to the statistics for the current frame.
447 * This function is used to optionally gather per-frame tracking metrics (e.g., number of tracked points, projection errors) when statistics collection is enabled.
448 * @param frameIndex The index of the current frame to check, must match the frame index of the last entry in framesStatistics_
449 * @param frameStatistics The resulting pointer to the frame statistics object for the given frame, nullptr if statistics are disabled or unavailable
450 * @return True if frame statistics are enabled and available for the specified frame; false otherwise
451 */
452 bool needsFrameStatistics(const Index32 frameIndex, FrameStatistics*& frameStatistics);
453
454 /**
455 * Tracks image points from the previous frame to the current frame and determines the camera pose.
456 * This function performs frame-to-frame 2D point tracking using the frame pyramids, then estimates the 6-DOF camera pose using the tracked 2D-3D correspondences via a robust estimation approach.
457 * @param camera The camera profile to be used, must be valid
458 * @param currentFrameIndex The index of the current frame, with range [1, infinity)
459 * @param randomGenerator A random generator for the RANSAC-based pose estimation
460 * @param previousCamera_Q_currentCamera The rotation from the current camera frame to the previous camera frame (e.g., from IMU), can be invalid if not available
461 * @return The shared camera pose if pose estimation succeeded, nullptr otherwise
462 */
463 SharedCameraPose trackImagePointsAndDeterminePose(const AnyCamera& camera, const Index32 currentFrameIndex, RandomGenerator& randomGenerator, const Quaternion& previousCamera_Q_currentCamera);
464
465 /**
466 * Resets all localized 3D object points and related state during re-initialization.
467 * This function clears the map when localized object points are not precise enough and the tracker needs to restart initialization.<br>
468 * The observations of currently visible object points are preserved as unlocalized points for potential re-triangulation.
469 */
471
472 /**
473 * Post-processing function:
474 *
475 * Performs post-processing after a frame has been handled by the main tracking pipeline.
476 * This function initializes or clears the occupancy array, processes tracking results to update point tracks
477 * and localized object points, detects new feature points, and updates tracking correspondences for the next frame.
478 */
480
481 /**
482 * Post-processing function:
483 *
484 * Processes tracking results by updating point tracks and localized object points with new observations.
485 * @param currentFrameIndex The index of the current frame being processed, with range [0, infinity)
486 * @param trackingCorrespondences The tracking correspondences containing previous/current image points, point ids, and validity flags
487 */
488 void processTrackingResults(const Index32 currentFrameIndex, const TrackingCorrespondences& trackingCorrespondences);
489
490 /**
491 * Post-processing function:
492 *
493 * Detects new Harris corner features and adds them as unlocalized object points for tracking.
494 * This function first checks if the occupancy array needs more points.<br>
495 * Further, the function may match new feature points with existing localized object points.
496 * @param camera The camera model used for projection, must be valid
497 * @param currentFrameIndex The index of the current frame, with range [0, infinity)
498 * @param yFramePyramid The grayscale frame pyramid for corner detection, must be valid and match camera dimensions
499 * @param tryMatchCornersToLocalizedObjectPoints True to attempt matching corners to existing localized object points before adding as new tracks
500 * @return True if detection succeeded or was skipped due to sufficient coverage; false if corner detection failed
501 */
502 bool detectNewImagePoints(const AnyCamera& camera, const Index32 currentFrameIndex, const CV::FramePyramid& yFramePyramid, const bool tryMatchCornersToLocalizedObjectPoints);
503
504 /**
505 * Post-processing function:
506 *
507 * Matches newly detected Harris corners to existing localized 3D object points that are not currently being tracked.
508 * This function attempts to re-observe localized object points by projecting them into the current frame and matching nearby corners using FREAK descriptor comparison.<br>
509 * Successfully matched corners are removed from the input vector.
510 * @param camera The camera model used for projection, must be valid
511 * @param currentFrameIndex The index of the current frame, with range [0, infinity)
512 * @param cameraPose The current camera pose, must be valid
513 * @param yFramePyramid The grayscale frame pyramid for descriptor computation, must be valid and match camera dimensions
514 * @param corners The detected Harris corners to match; matched corners will be removed from this vector
515 */
516 void matchCornersToLocalizedObjectPoints(const AnyCamera& camera, const Index32 currentFrameIndex, const CameraPose& cameraPose, const CV::FramePyramid& yFramePyramid, CV::Detector::HarrisCorners& corners);
517
518 /**
519 * Post-processing function:
520 *
521 * Matches localized 3D object points to locally detected Harris corners.
522 * This function projects each untracked localized object point into the current frame, detects Harris corners in a small region around the projection, and matches using FREAK descriptor comparison.<br>
523 * Successfully matched points are added to the occupancy array.
524 * @param camera The camera model used for projection, must be valid
525 * @param currentFrameIndex The index of the current frame, with range [0, infinity)
526 * @param cameraPose The current camera pose, must be valid
527 * @param yFramePyramid The grayscale frame pyramid for corner detection and descriptor computation, must be valid and match camera dimensions
528 */
529 void matchLocalizedObjectPointsToCorners(const AnyCamera& camera, const Index32 currentFrameIndex, const CameraPose& cameraPose, const CV::FramePyramid& yFramePyramid);
530
531 /**
532 * The main loop of the background processing thread.
533 * @see Thread::threadRun()
534 */
535 void threadRun() override;
536
537 /**
538 * Background function:
539 *
540 * Determines initial 3D object points from 2D point correspondences during tracker initialization.
541 * This function uses stereoscopic geometry to triangulate initial object points from tracked 2D features between a suitable earlier frame and the latest frame.<br>
542 * @param camera The camera model used for projection, must be valid
543 * @param latestFrameIndex The index of the most recent frame
544 * @param randomGenerator A random generator for RANSAC-based pose estimation
545 * @return True if initialization succeeded and initial object points were determined; false otherwise
546 */
547 bool determineInitialObjectPoints(const AnyCamera& camera, const Index32 latestFrameIndex, RandomGenerator& randomGenerator);
548
549 /**
550 * Background function:
551 *
552 * Re-optimizes object points that have been marked as inaccurate.
553 * For each inaccurate object point that is visible in the current frame, the function tries to re-triangulate/optimize its 3D position.<br>
554 * Successfully optimized points are updated in the map; points that remain inaccurate are kept for potential recovery during the next Bundle Adjustment.
555 * @param camera The camera model used for projection, must be valid
556 * @param currentFrameIndex The index of the current/latest frame
557 * @param inaccurateObjectPointIdSet The set of object point ids known to be inaccurate, must not be empty
558 */
559 void updateInaccurateObjectPoints(const AnyCamera& camera, const Index32 currentFrameIndex, const UnorderedIndexSet32& inaccurateObjectPointIdSet);
560
561 /**
562 * Background function:
563 *
564 * Performs bundle adjustment optimization on camera poses and 3D object points.
565 * @param camera The camera model used for projection, must be valid
566 * @param currentFrameIndex The index of the current frame
567 */
568 void bundleAdjustment(const AnyCamera& camera, const Index32 currentFrameIndex);
569
570 /**
571 * Background function:
572 *
573 * Localizes unlocalized object points by triangulating their 3D positions from multiple observations.
574 * @param camera The camera profile used for triangulation, must be valid
575 * @param currentFrameIndex The index of the current frame up to which observations are considered
576 */
577 void localizeUnlocalizedObjectPoints(const AnyCamera& camera, const Index32 currentFrameIndex);
578
579 /**
580 * Background function:
581 *
582 * Attempts to re-localize the tracker by matching unlocalized point tracks to known localized 3D object points.
583 * The function computes FREAK descriptors for currently tracked 2D points and matches them against descriptors of localized object points.<br>
584 * Using RANSAC-based pose estimation, it determines the camera pose and merges successfully matched point tracks into their corresponding localized object points.
585 * @param camera The camera model used for projection, must be valid
586 * @param latestFrameIndex The index of the latest frame to use for re-localization
587 * @param yFramePyramid The frame pyramid of the latest frame for descriptor computation, must be valid
588 * @return True if re-localization succeeded; False otherwise
589 */
590 bool relocalize(const AnyCamera& camera, const Index32 latestFrameIndex, const CV::FramePyramid& yFramePyramid);
591
592 /**
593 * Post-processing function:
594 *
595 * Returns a new unique object point id.
596 * @return The unique object point id
597 */
598 inline Index32 uniqueObjectPointId();
599
600 /**
601 * Background function:
602 *
603 * Determines camera poses for frames that are missing valid poses.
604 * The function performs both a backward pass (from startFrameIndex towards earlier frames) and a forward pass (towards later frames).<br>
605 * For each frame without a pose, it uses the localized object points to estimate the camera pose via RANSAC-based PnP with optional gravity constraints.
606 * @param camera The camera model used for projection, must be valid
607 * @param startFrameIndex The frame index to start from (excluding), must be valid
608 * @param skipFrameIndex Optional frame index to skip during processing, Index32(-1) to skip none
609 * @param stopAtValidPose True to stop each pass when encountering a frame with a valid pose; False to continue processing all frames
610 * @tparam tUseReadLock True to acquire a read lock on the mutex; False if the caller already holds the lock
611 */
612 template <bool tUseReadLock = true>
613 void determineCameraPoses(const AnyCamera& camera, const Index32 startFrameIndex, const Index32 skipFrameIndex = Index32(-1), const bool stopAtValidPose = false);
614
615 /**
616 * Background function:
617 *
618 * Determines whether bundle adjustment optimization should be triggered.
619 * The function checks three conditions and returns true if any is met:
620 * 1. The average reprojection error exceeds the specified threshold
621 * 2. Less than 50% of visible object points have been previously bundle-adjusted
622 * 3. The camera has moved significantly from all existing keyframe positions (baseline exceeds threshold)
623 * @param camera The camera model used for projection, must be valid
624 * @param currentCameraPose The current camera pose to evaluate
625 * @param currentFrameIndex The index of the current frame
626 * @param maximalProjectionError The maximum allowed average projection error before triggering bundle adjustment
627 * @param necessaryMapVersion The required map version for consistency checks (used in debug assertions)
628 * @return True if bundle adjustment is needed; false otherwise
629 */
630 bool isBundleAdjustmentNeeded(const AnyCamera& camera, const CameraPose& currentCameraPose, const Index32 currentFrameIndex, const Scalar maximalProjectionError, const unsigned int necessaryMapVersion) const;
631
632 /**
633 * Background function:
634 *
635 * Determines the topology for the bundle adjustment.
636 * The function selects a subset of keyframes to be used in the bundle adjustment.
637 * The selection strategy tries to maximize the spatial distribution of keyframes while ensuring sufficient feature overlap.
638 * @param necessaryDataVersion The required map version; only frames with camera poses matching this version are considered
639 * @param cameraPoses The camera poses of all frames, must be valid
640 * @param localizedObjectPointMap The map of localized object points, must be valid
641 * @param maximalNumberNewKeyFrames The maximal number of new keyframes to add in this call, with range [1, infinity)
642 * @param maximalNumberKeyFrames The maximal number of keyframes to be selected, with range [2, infinity)
643 * @param keyFrameIndices The indices of the selected keyframes, will be updated with new keyframes and may have old ones removed
644 * @param objectPointToObservations The resulting map mapping object point ids to their observations in the selected keyframes
645 * @param minimalNumberKeyFrames The minimal number of keyframes to be selected, with range [2, maximalNumberKeyFrames]
646 * @param maximalFrameHistory The maximal frame history to consider when selecting keyframes, with range [1, infinity)
647 * @return True if the topology was successfully determined with at least minimalNumberKeyFrames; false otherwise
648 */
649 static bool determineBundleAdjustmentTopology(const Index32 necessaryDataVersion, const CameraPoses& cameraPoses, const LocalizedObjectPointMap& localizedObjectPointMap, const size_t maximalNumberNewKeyFrames, const size_t maximalNumberKeyFrames, Indices32& keyFrameIndices, ObjectPointToObservations& objectPointToObservations, const size_t minimalNumberKeyFrames = 3, const size_t maximalFrameHistory = 300);
650
651 /**
652 * Background function:
653 *
654 * Computes and adds FREAK visual descriptors to localized object points that need descriptors.
655 * Descriptors are used for re-matching object points when they lose frame-to-frame tracking.
656 * @param camera The camera model used for descriptor computation, must be valid
657 * @param currentFrameIndex The index of the current frame, with range [0, infinity)
658 * @param yFramePyramid The grayscale frame pyramid for descriptor computation, must be valid and match camera dimensions
659 */
660 void describeObjectPoints(const AnyCamera& camera, const Index32 currentFrameIndex, const CV::FramePyramid& yFramePyramid);
661
662 /**
663 * Determines the frame index with the most visible localized object points.
664 * This function iterates through all frames with valid camera poses and counts how many
665 * localized object points have observations in each frame, returning the frame with the highest count.
666 * Only frames whose camera pose has a matching map version are considered.
667 * @param necessaryDataVersion The required map version; only frames with camera poses matching this version are considered
668 * @param cameraPoses The camera poses for all frames, must not be empty
669 * @param localizedObjectPointMap The map of localized 3D object points with their observations
670 * @param minimalNumberObjectPoints The minimal number of object points that must be visible in a frame for it to be considered valid, with range [1, infinity)
671 * @param ignoreFrameIndices Optional set of frame indices to skip during the search, nullptr to consider all frames
672 * @return The index of the frame with the most visible object points (meeting the threshold), or Index32(-1) if no valid frame was found
673 */
674 static Index32 frameIndexWithMostLocalizedObjectPoints(const Index32 necessaryDataVersion, const CameraPoses& cameraPoses, const LocalizedObjectPointMap& localizedObjectPointMap, const size_t minimalNumberObjectPoints, const UnorderedIndexSet32* ignoreFrameIndices = nullptr);
675
676 /**
677 * Returns the maximal distance between two descriptors so that they are considered a match (35% of descriptor size).
678 * @return The descriptor matching threshold
679 */
680 static constexpr unsigned int descriptorThreshold();
681
682 protected:
683
684 /// The current operational state of the tracker, modified only by the foreground thread but read by both foreground and background threads.
685 std::atomic<TrackerState> trackerState_ = TS_UNKNOWN;
686
687 /// The configuration of the tracker.
689
690 /// The tracking parameters defining pyramid configuration for feature tracking.
692
693 /// The occupancy array for spatial distribution of feature points across the image.
695
696 /// The map of 2D point tracks, mapping object point ids to their tracked 2D observations across frames.
698
699 /// The map of localized 3D object points, mapping object point ids to their 3D positions and observation history.
701
702 /// The counter for generating unique object point ids.
703 Index32 objectPointIdCounter_ = 0u;
704
705 /// The manager for frame pyramids providing thread-safe access to image pyramids for foreground and background processing.
707
708 /// The adaptive Harris corner detection threshold, adjusted dynamically based on feature coverage.
709 unsigned int harrisThreshold_ = 0u;
710
711 /// The frame pyramid of the previous frame used for frame-to-frame feature tracking.
713
714 /// The frame pyramid of the current frame used for frame-to-frame feature tracking.
716
717 /// The orientation of the previous camera in an external/arbitrary world coordinate system (e.g., from IMU), used to compute frame-to-frame rotation.
718 Quaternion anyWorld_Q_previousCamera_ = Quaternion(false);
719
720 /// Frame-to-frame tracking correspondences.
722
723 /// Pose estimation correspondences.
725
726 /// The history of camera poses for all processed frames.
728
729 /// The history of gravity vectors in camera coordinates for processed frames.
731
732 /// The camera profile used for projection, cloned from the first frame's camera.
734
735 /// The random generator for the foreground thread.
737
738 /// The random generator for the background thread.
740
741 /// The frame indices of keyframes used in the most recent Bundle Adjustment.
743
744 /// The squared baseline (camera translation distance) from the most recent Bundle Adjustment, used to trigger new optimizations.
745 Scalar bundleAdjustmentSqrBaseline_ = Numeric::minValue();
746
747 /// The ids of object points which have been used during the previous Bundle Adjustment.
749
750 /// The performance statistics for this tracker.
752
753 /// The set of object point ids whose 3D positions are considered inaccurate and need re-optimization.
755
756 /// The background task which will execute the post processing for the handleFrame() function.
758
759 /// The rate calculator for measuring the frame processing rate.
761
762 /// The debug data for visualization and analysis purposes.
764
765 /// The mutex for synchronizing access to shared data between foreground and background threads.
766 mutable Mutex mutex_;
767
768 /// True, if the background thread needs to determine initial object points. Only the foreground thread can set this task, only the background thread can clear the task.
769 std::atomic_bool taskDetermineInitialObjectPoints_ = false;
770
771 /// The index of the frame in which post estimation failed the first time, -1 if a valid pose is known
772 Index32 poseEstimationFailedFrameIndex_ = Index32(-1);
773
774 /// The version counter for the map, incremented after each Bundle Adjustment to track pose and object point consistency.
775 Index32 mapVersion_ = 0u;
776
777 /// The minimal localization precision for projecting object points; points below this threshold use the previous 2D position instead.
778 static constexpr LocalizedObjectPoint::LocalizationPrecision minimalFrontPrecision_ = LocalizedObjectPoint::LP_LOW;
779
780 /// True to enable collecting per-frame statistics; false to disable.
781 bool frameStatisticsEnabled_ = true;
782
783 /// The collected statistics for each processed frame.
785
786 private:
787
788 /// Reusable pairs of object point ids and object point positions, used in updateInaccurateObjectPoints().
790};
791
793 frameIndex_(frameIndex)
794{
795 // nothing to do here
796}
797
799 keyFrameIndices_(keyFrameIndices)
800{
801 optimizationObjectMap_.reserve(256);
802}
803
805 position_(position),
806 precision_(precision)
807{
808 // nothing to do here
809}
810
812{
813 if constexpr (isEnabled_)
814 {
815 statistic_ = &statistic;
816 statistic_->start();
817 }
818}
819
821{
822 if constexpr (isEnabled_)
823 {
824 if (statistic_ != nullptr)
825 {
826 statistic_->stop();
827 }
828 }
829}
830
832{
833 if constexpr (isEnabled_)
834 {
835 statistic.start();
836 }
837}
838
840{
841 if constexpr (isEnabled_)
842 {
843 statistic.stop();
844 }
845}
846
848{
849 return cameraPoses_.frameIndex();
850}
851
853{
854 // now thread-safty necessary as the function is only called from one place
855
856 const Index32 id = ++objectPointIdCounter_;
857
858 return id;
859}
860
861constexpr unsigned int TrackerMono::descriptorThreshold()
862{
863 return CV::Detector::FREAKDescriptor32::descriptorMatchingThreshold(35u);
864}
865
866}
867
868}
869
870}
871
872#endif // META_OCEAN_TRACKING_SLAM_TRACKER_MONO_H
This class implements the abstract base class for all AnyCamera objects.
Definition AnyCamera.h:131
This class implements a frame pyramid.
Definition FramePyramid.h:46
This class implements Ocean's image class.
Definition Frame.h:1879
EstimatorType
Definition of individual robust estimator types.
Definition Estimator.h:34
This class implements a simple module gathering high performance timer statistics.
Definition HighPerformanceTimer.h:124
void stop()
Stops a measurement.
void start()
Starts a new measurement.
This class implements a generator for random numbers.
Definition RandomGenerator.h:42
This class implements a calculate for rates like frame rates.
Definition RateCalculator.h:25
This class implements a thread.
Definition Thread.h:115
This class implements a task which runs in the background while the caller is able to wait for the ta...
Definition BackgroundTask.h:48
This class holds the camera pose of a camera in relation to the world.
Definition CameraPose.h:46
This class implements a container for camera poses.
Definition CameraPoses.h:32
Index32 frameIndex() const
Returns the current frame index.
Definition CameraPoses.h:195
This class implements a scoped pyramid object providing automatic lifetime management.
Definition FramePyramidManager.h:41
This class manages a pool of frame pyramids for efficient reuse.
Definition FramePyramidManager.h:33
This class implements a container for gravity vectors associated with frame indices.
Definition Gravities.h:29
This class implements a thread-safe container for object point ids.
Definition LocalizedObjectPoint.h:155
LocalizationPrecision
Definition of possible localization precisions.
Definition LocalizedObjectPoint.h:59
This class implements an occupancy array allowing to keep track of occupied and unoccupied bins in a ...
Definition OccupancyArray.h:32
This class holds 2D-3D point correspondences for camera pose estimation.
Definition PoseCorrespondences.h:39
This class implements a configuration object for the tracker.
Definition tracking/slam/Tracker.h:56
This class holds tracking parameters for different tracking modes.
Definition tracking/slam/Tracker.h:167
This class implements the base class for all SLAM trackers.
Definition tracking/slam/Tracker.h:35
This class holds information about a 3D object point for visualization purposes.
Definition slam/TrackerMono.h:318
Point()=default
Creates a default point object.
This class holds debug data for visualization and analysis purposes.
Definition slam/TrackerMono.h:305
void update(DebugData &&debugData)
Updates the debug data by merging from another DebugData object.
std::pair< Index32, Vectors2 > TrackPair
Definition of a pair combining the last frame index with a sequence of 2D image points.
Definition slam/TrackerMono.h:309
std::unordered_map< Index32, TrackPair > TracksMap
Definition of a map mapping object point ids to their track data.
Definition slam/TrackerMono.h:312
std::unordered_map< Index32, Point > PointMap
Definition of a map mapping object point ids to their 3D positions and precisions.
Definition slam/TrackerMono.h:346
TracksMap tracksMap_
The map of 2D point tracks, mapping object point ids to their last frame index and sequence of 2D obs...
Definition slam/TrackerMono.h:376
UnorderedIndexSet32 poseNotPreciseObjectPointIds_
The set of object point ids with imprecise localization used for pose estimation.
Definition slam/TrackerMono.h:385
UnorderedIndexSet32 inaccurateObjectPointIdSet_
The set of object point ids that were identified as outliers during pose estimation.
Definition slam/TrackerMono.h:388
PointMap pointMap_
The map of 3D object points, mapping object point ids to their 3D positions and localization precisio...
Definition slam/TrackerMono.h:379
UnorderedIndexSet32 posePreciseObjectPointIds_
The set of object point ids with precise localization used for pose estimation.
Definition slam/TrackerMono.h:382
void update(const Index32 frameIndex, const TrackingCorrespondences &trackingCorrespondences, const PoseCorrespondences &poseCorrespondences)
Updates the tracking data with new frame correspondences.
This class holds per-frame tracking statistics for debugging and analysis.
Definition slam/TrackerMono.h:60
FrameStatistics(const Index32 frameIndex)
Creates a new frame statistics object for a specific frame.
Definition slam/TrackerMono.h:792
bool isValid() const
Returns whether the frame statistics contain valid data.
This class holds data for a single object point to be optimized.
Definition slam/TrackerMono.h:119
Vector3 objectPoint_
The 3D position of the object point.
Definition slam/TrackerMono.h:123
std::vector< size_t > keyFrameSubsetIndices_
The indices into the keyframe subset where this object point is observed.
Definition slam/TrackerMono.h:126
Vectors2 imagePoints_
The 2D image point observations corresponding to keyFrameSubsetIndices_.
Definition slam/TrackerMono.h:129
Background object:
Definition slam/TrackerMono.h:112
const Indices32 & keyFrameIndices_
Reference to the keyframe indices to consider for optimization.
Definition slam/TrackerMono.h:168
void collectObjectPoints(const LocalizedObjectPointMap &localizedObjectPointMap, const UnorderedIndexSet32 &previousBundleAdjustmentObjectPointIdSet)
Collects object points that are visible in at least one keyframe and were not part of the previous Bu...
std::unordered_map< Index32, OptimizationObject > OptimizationObjectMap
Definition of a map mapping object point ids to their optimization data.
Definition slam/TrackerMono.h:133
ObjectPointOptimization(const Indices32 &keyFrameIndices)
Creates a new object point optimization object.
Definition slam/TrackerMono.h:798
OptimizationObjectMap optimizationObjectMap_
The map of object points to be optimized.
Definition slam/TrackerMono.h:171
void optimizeObjectPointsIF(const AnyCamera &camera, const HomogenousMatrices4 &optimizedFlippedCameras_T_world, const Geometry::Estimator::EstimatorType estimatorType, const Scalar maximalProjectionError, UnorderedIndexSet32 &currentBundleAdjustmentObjectPointIdSet, Indices32 &currentObjectPointIds, Vectors3 &currentObjectPointPositions, Indices32 &inaccurateObjectPointIds)
Optimizes the collected object points using non-linear optimization with fixed camera poses.
This class defines a scoped high performance statistic module.
Definition slam/TrackerMono.h:206
~ScopedStatistic()
Destructs a scoped statistic object and stops the measurement.
Definition slam/TrackerMono.h:820
ScopedStatistic(const ScopedStatistic &)=delete
Disabled copy constructor.
ScopedStatistic(HighPerformanceStatistic &statistic)
Creates a new scoped statistic object and starts a new measurement.
Definition slam/TrackerMono.h:811
This class encapsulates all performance measurement logic for the TrackerMono.
Definition slam/TrackerMono.h:195
std::string toString() const
Returns a string with the relevant performance information.
HighPerformanceStatistic relocalize_
Performance statistic for re-localization.
Definition slam/TrackerMono.h:272
HighPerformanceStatistic detectNewImagePoints_
Performance statistic for detecting new image points.
Definition slam/TrackerMono.h:278
void stop(HighPerformanceStatistic &statistic) const
Stops a specific performance measurement.
Definition slam/TrackerMono.h:839
HighPerformanceStatistic determineInitialObjectPoints_
Performance statistic for determining initial object points.
Definition slam/TrackerMono.h:269
HighPerformanceStatistic matchCornersToLocalizedObjectPoints_
Performance statistic for matching unlocalized object points.
Definition slam/TrackerMono.h:281
void start(HighPerformanceStatistic &statistic) const
Starts a specific performance measurement.
Definition slam/TrackerMono.h:831
HighPerformanceStatistic matchLocalizedObjectPointsToCorners_
Performance statistic for matching unlocalized object points.
Definition slam/TrackerMono.h:284
HighPerformanceStatistic trackImagePointsDatabase_
Performance statistic for updating the tracking database.
Definition slam/TrackerMono.h:260
HighPerformanceStatistic bundleAdjustment_
Performance statistic for Bundle Adjustment.
Definition slam/TrackerMono.h:275
HighPerformanceStatistic determineCameraPose_
Performance statistic for determining the camera pose.
Definition slam/TrackerMono.h:263
HighPerformanceStatistic trackImagePoints_
Performance statistic for tracking image points.
Definition slam/TrackerMono.h:257
HighPerformanceStatistic handleFrame_
Performance statistic for the handleFrame() function.
Definition slam/TrackerMono.h:254
HighPerformanceStatistic optimizeBadObjectPoints_
Performance statistic for optimizing bad object points.
Definition slam/TrackerMono.h:266
This class implements a monocular SLAM tracker.
Definition slam/TrackerMono.h:52
PointTrackMap pointTrackMap_
The map of 2D point tracks, mapping object point ids to their tracked 2D observations across frames.
Definition slam/TrackerMono.h:697
bool relocalize(const AnyCamera &camera, const Index32 latestFrameIndex, const CV::FramePyramid &yFramePyramid)
Background function:
void matchLocalizedObjectPointsToCorners(const AnyCamera &camera, const Index32 currentFrameIndex, const CameraPose &cameraPose, const CV::FramePyramid &yFramePyramid)
Post-processing function:
FramePyramidManager::ScopedPyramid previousPyramid_
The frame pyramid of the previous frame used for frame-to-frame feature tracking.
Definition slam/TrackerMono.h:712
TrackingParameters trackingParameters_
The tracking parameters defining pyramid configuration for feature tracking.
Definition slam/TrackerMono.h:691
void bundleAdjustment(const AnyCamera &camera, const Index32 currentFrameIndex)
Background function:
bool configure(const Configuration &configuration)
Configures the tracker with the specified settings.
FramesStatistics framesStatistics() const
Returns the collected per-frame statistics.
SharedCameraPose trackImagePointsAndDeterminePose(const AnyCamera &camera, const Index32 currentFrameIndex, RandomGenerator &randomGenerator, const Quaternion &previousCamera_Q_currentCamera)
Tracks image points from the previous frame to the current frame and determines the camera pose.
bool handleFrame(const AnyCamera &camera, Frame &&yFrame, HomogenousMatrix4 &world_T_camera, const Vector3 &cameraGravity=Vector3(0, 0, 0), const Quaternion &anyWorld_Q_camera=Quaternion(false), DebugData *debugData=nullptr)
Processes a new camera frame and determines the camera pose.
OccupancyArray occupancyArray_
The occupancy array for spatial distribution of feature points across the image.
Definition slam/TrackerMono.h:694
void resetLocalizedObjectPoints()
Resets all localized 3D object points and related state during re-initialization.
void threadRun() override
The main loop of the background processing thread.
bool needsFrameStatistics(const Index32 frameIndex, FrameStatistics *&frameStatistics)
Checks whether frame statistics collection is enabled and retrieves a pointer to the statistics for t...
Index32 frameIndex() const
Returns the index of the current frame which the tracker has just processed.
Definition slam/TrackerMono.h:847
static constexpr unsigned int descriptorThreshold()
Returns the maximal distance between two descriptors so that they are considered a match (35% of desc...
Definition slam/TrackerMono.h:861
void processTrackingResults(const Index32 currentFrameIndex, const TrackingCorrespondences &trackingCorrespondences)
Post-processing function:
CameraPoses cameraPoses_
The history of camera poses for all processed frames.
Definition slam/TrackerMono.h:727
TrackerMono()
Creates a new tracker object.
UnorderedIndexSet32 bundleAdjustmentObjectPointIdSet_
The ids of object points which have been used during the previous Bundle Adjustment.
Definition slam/TrackerMono.h:748
Mutex mutex_
The mutex for synchronizing access to shared data between foreground and background threads.
Definition slam/TrackerMono.h:766
Indices32 bundleAdjustmentKeyFrameIndices_
The frame indices of keyframes used in the most recent Bundle Adjustment.
Definition slam/TrackerMono.h:742
Index32 objectPointIdCounter_
The counter for generating unique object point ids.
Definition slam/TrackerMono.h:703
Configuration configuration_
The configuration of the tracker.
Definition slam/TrackerMono.h:688
void updateInaccurateObjectPoints(const AnyCamera &camera, const Index32 currentFrameIndex, const UnorderedIndexSet32 &inaccurateObjectPointIdSet)
Background function:
void describeObjectPoints(const AnyCamera &camera, const Index32 currentFrameIndex, const CV::FramePyramid &yFramePyramid)
Background function:
PerformanceStatistics performanceStatistics_
The performance statistics for this tracker.
Definition slam/TrackerMono.h:751
void postHandleFrame()
Post-processing function:
FramePyramidManager framePyramidManager_
The manager for frame pyramids providing thread-safe access to image pyramids for foreground and back...
Definition slam/TrackerMono.h:706
~TrackerMono() override
Destructs this tracker object.
LocalizedObjectPointMap localizedObjectPointMap_
The map of localized 3D object points, mapping object point ids to their 3D positions and observation...
Definition slam/TrackerMono.h:700
PoseCorrespondences poseCorrespondences_
Pose estimation correspondences.
Definition slam/TrackerMono.h:724
std::pair< Index32, Vector3 > ObjectPointIdPositionPair
Definition of a pair combining object point ids and object point positions.
Definition slam/TrackerMono.h:290
void matchCornersToLocalizedObjectPoints(const AnyCamera &camera, const Index32 currentFrameIndex, const CameraPose &cameraPose, const CV::FramePyramid &yFramePyramid, CV::Detector::HarrisCorners &corners)
Post-processing function:
static Index32 frameIndexWithMostLocalizedObjectPoints(const Index32 necessaryDataVersion, const CameraPoses &cameraPoses, const LocalizedObjectPointMap &localizedObjectPointMap, const size_t minimalNumberObjectPoints, const UnorderedIndexSet32 *ignoreFrameIndices=nullptr)
Determines the frame index with the most visible localized object points.
std::vector< FrameStatistics > FramesStatistics
Definition of a vector holding frame statistics.
Definition slam/TrackerMono.h:100
std::string performance() const
Returns a string with performance statistics for the tracker.
bool isBundleAdjustmentNeeded(const AnyCamera &camera, const CameraPose &currentCameraPose, const Index32 currentFrameIndex, const Scalar maximalProjectionError, const unsigned int necessaryMapVersion) const
Background function:
std::unordered_map< Index32, PoseIndexToImagePointPairs > ObjectPointToObservations
Definition of an unordered map mapping object point ids to observation pairs.
Definition slam/TrackerMono.h:187
bool detectNewImagePoints(const AnyCamera &camera, const Index32 currentFrameIndex, const CV::FramePyramid &yFramePyramid, const bool tryMatchCornersToLocalizedObjectPoints)
Post-processing function:
SharedAnyCamera camera_
The camera profile used for projection, cloned from the first frame's camera.
Definition slam/TrackerMono.h:733
TrackingCorrespondences trackingCorrespondences_
Frame-to-frame tracking correspondences.
Definition slam/TrackerMono.h:721
static bool determineBundleAdjustmentTopology(const Index32 necessaryDataVersion, const CameraPoses &cameraPoses, const LocalizedObjectPointMap &localizedObjectPointMap, const size_t maximalNumberNewKeyFrames, const size_t maximalNumberKeyFrames, Indices32 &keyFrameIndices, ObjectPointToObservations &objectPointToObservations, const size_t minimalNumberKeyFrames=3, const size_t maximalFrameHistory=300)
Background function:
FramesStatistics framesStatistics_
The collected statistics for each processed frame.
Definition slam/TrackerMono.h:784
RandomGenerator randomGenerator_
The random generator for the foreground thread.
Definition slam/TrackerMono.h:736
BackgroundTask postHandleFrameTask_
The background task which will execute the post processing for the handleFrame() function.
Definition slam/TrackerMono.h:757
Gravities gravities_
The history of gravity vectors in camera coordinates for processed frames.
Definition slam/TrackerMono.h:730
void localizeUnlocalizedObjectPoints(const AnyCamera &camera, const Index32 currentFrameIndex)
Background function:
Index32 uniqueObjectPointId()
Post-processing function:
Definition slam/TrackerMono.h:852
ObjectPointIdPositionPairs reusableObjectPointIdPositionPairs_
Reusable pairs of object point ids and object point positions, used in updateInaccurateObjectPoints()...
Definition slam/TrackerMono.h:789
bool determineInitialObjectPoints(const AnyCamera &camera, const Index32 latestFrameIndex, RandomGenerator &randomGenerator)
Background function:
void determineCameraPoses(const AnyCamera &camera, const Index32 startFrameIndex, const Index32 skipFrameIndex=Index32(-1), const bool stopAtValidPose=false)
Background function:
FramePyramidManager::ScopedPyramid currentPyramid_
The frame pyramid of the current frame used for frame-to-frame feature tracking.
Definition slam/TrackerMono.h:715
std::vector< PoseIndexToImagePointPair > PoseIndexToImagePointPairs
Definition of a vector holding pairs of frame indices and 2D observations.
Definition slam/TrackerMono.h:182
LocalizedObjectPoint::ObjectPointIdSet inaccurateObjectPointIdSet_
The set of object point ids whose 3D positions are considered inaccurate and need re-optimization.
Definition slam/TrackerMono.h:754
RateCalculator handleFrameRateCalculator_
The rate calculator for measuring the frame processing rate.
Definition slam/TrackerMono.h:760
DebugData debugData_
The debug data for visualization and analysis purposes.
Definition slam/TrackerMono.h:763
std::pair< unsigned int, Vector2 > PoseIndexToImagePointPair
Definition of a pair combining a frame index with a 2D observation.
Definition slam/TrackerMono.h:177
RandomGenerator randomGeneratorBackground_
The random generator for the background thread.
Definition slam/TrackerMono.h:739
std::vector< ObjectPointIdPositionPair > ObjectPointIdPositionPairs
Definition of a vector holding object point id and position pairs.
Definition slam/TrackerMono.h:295
This class holds 2D-2D point correspondences for frame-to-frame tracking.
Definition TrackingCorrespondences.h:40
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
std::unordered_set< Index32 > UnorderedIndexSet32
Definition of an unordered_set holding 32 bit indices.
Definition Base.h:126
std::vector< HarrisCorner > HarrisCorners
Definition of a vector holding Harris corners.
Definition HarrisCorner.h:30
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::shared_ptr< AnyCamera > SharedAnyCamera
Definition of a shared pointer holding an AnyCamera object with Scalar precision.
Definition AnyCamera.h:61
std::vector< HomogenousMatrix4 > HomogenousMatrices4
Definition of a vector holding HomogenousMatrix4 objects.
Definition HomogenousMatrix4.h:73
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition Vector3.h:65
std::shared_mutex Mutex
Definition of a mutex supporting read and write locks.
Definition Mutex.h:78
std::unordered_map< Index32, LocalizedObjectPoint > LocalizedObjectPointMap
Definition of an unordered map mapping object point ids to localized object points.
Definition LocalizedObjectPoint.h:43
std::shared_ptr< CameraPose > SharedCameraPose
Definition of a shared pointer holding a CameraPose object.
Definition CameraPose.h:36
std::unordered_map< Index32, PointTrack > PointTrackMap
Definition of an unordered map mapping object point ids to point tracks.
Definition PointTrack.h:32
The namespace covering the entire Ocean framework.
Definition Accessor.h:15