8#ifndef META_OCEAN_TRACKING_SLAM_POINT_TRACK_H
9#define META_OCEAN_TRACKING_SLAM_POINT_TRACK_H
63 inline void addObservation(
const Index32 frameIndex,
const Vector2& imagePoint);
71 inline bool hasObservation(
const Index32 frameIndex,
Vector2* imagePoint =
nullptr)
const;
84 inline const Vector2& lastImagePoint()
const;
90 inline Index32 firstFrameIndex()
const;
96 inline Index32 lastFrameIndex()
const;
102 inline Index32 nextFrameIndex()
const;
108 inline const Vectors2& imagePoints()
const;
114 inline size_t numberObservations()
const;
121 inline size_t numberObservationsUntil(
const Index32 frameIndex)
const;
128 inline bool isValid()
const;
174 firstFrameIndex_(firstFrameIndex)
185 firstFrameIndex_(firstFrameIndex),
186 imagePoints_(std::move(imagePoints))
195 ocean_assert_and_suppress_unused(frameIndex ==
lastFrameIndex() + 1u, frameIndex);
204 if (frameIndex < firstFrameIndex_ || frameIndex >
lastFrameIndex())
209 if (imagePoint !=
nullptr)
This class implements the abstract base class for all AnyCamera objects.
Definition AnyCamera.h:131
This class implements a point track which stores continuous 2D observations of a 3D object point over...
Definition PointTrack.h:40
Index32 firstFrameIndex() const
Returns the index of the first frame in which the point was observed.
Definition PointTrack.h:232
size_t numberObservations() const
Returns the number of observations in this point track.
Definition PointTrack.h:258
const Vector2 & lastImagePoint() const
Returns the last observation of this point track.
Definition PointTrack.h:225
Vectors2 imagePoints_
The 2D image point observations for consecutive frames starting at firstFrameIndex_.
Definition PointTrack.h:170
Index32 nextFrameIndex() const
Returns the index of the next expected frame for a new observation.
Definition PointTrack.h:244
PointTrack(const Index32 firstFrameIndex, const Vector2 &imagePoint)
Creates a new point track with a single observation.
Definition PointTrack.h:173
Index32 firstFrameIndex_
The index of the first frame in which the point was observed, -1 if invalid.
Definition PointTrack.h:167
Index32 lastFrameIndex() const
Returns the index of the last frame in which the point was observed.
Definition PointTrack.h:237
const Vectors2 & imagePoints() const
Returns all 2D image point observations of this point track.
Definition PointTrack.h:251
size_t numberObservationsUntil(const Index32 frameIndex) const
Returns the number of observations up to and including a given frame index.
Definition PointTrack.h:265
bool isValid() const
Returns whether this point track is valid.
Definition PointTrack.h:279
static size_t determineTracksLengthUntil(const Index32 frameIndex, const PointTrackMap &pointTrackMap, const size_t minimalTracks, const double percentile)
Determines the percentile track length for a set of point tracks up to a given frame index.
static Scalar determineViewingAngle(const AnyCamera &camera, const HomogenousMatrix4 &world_T_camera0, const HomogenousMatrix4 &world_T_camera1, const Vectors2 &imagePoints0, const Vectors2 &imagePoints1, const Indices32 &validIndices, const double percentile)
Determines the percentile viewing angle between ray directions from two camera poses.
void addObservation(const Index32 frameIndex, const Vector2 &imagePoint)
Adds a new observation to this point track.
Definition PointTrack.h:191
bool hasObservation(const Index32 frameIndex, Vector2 *imagePoint=nullptr) const
Returns whether this point track has an observation for a given frame index.
Definition PointTrack.h:200
const Vector2 & observation(const Index32 frameIndex) const
Returns the observation for a given frame index.
Definition PointTrack.h:217
static void extractCorrespondences(const Index32 firstFrameIndex, const Index32 lastFrameIndex, const PointTrackMap &pointTrackMap, Vectors2 &firstImagePoints, Vectors2 &lastImagePoints, Indices32 &objectPointIds)
Extracts 2D-2D correspondences from point tracks that span between two frame indices.
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::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::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