8#ifndef META_OCEAN_TRACKING_OFFLINE_SLAM_TRACKER_PLANAR_H
9#define META_OCEAN_TRACKING_OFFLINE_SLAM_TRACKER_PLANAR_H
104 IterationResult onFrame(
const unsigned int previousIndex,
const unsigned int currentIndex,
const unsigned int iteration,
const unsigned int maximalIterations)
override;
110 bool onStart(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex)
override;
116 bool onStop(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex)
override;
243 IterationResult onFrame(
const unsigned int previousIndex,
const unsigned int currentIndex,
const unsigned int iteration,
const unsigned int maximalIterations)
override;
249 bool onStop(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex)
override;
326 IterationResult onFrame(
const unsigned int previousIndex,
const unsigned int currentIndex,
const unsigned int iteration,
const unsigned int maximalIterations)
override;
332 bool onStart(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex)
override;
338 bool onStop(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex)
override;
448 bool determinePlane(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex);
469 bool optimizePlane(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex);
This class implements a frame pyramid.
Definition FramePyramid.h:46
This class implement a sub-region either defined by 2D triangles or defined by a binary mask.
Definition SubRegion.h:32
This class implements Ocean's image class.
Definition Frame.h:1969
Definition of a frame type composed by the frame dimension, pixel format and pixel origin.
Definition Frame.h:30
static constexpr Scalar deg2rad(const Scalar deg)
This class implements a generator for random numbers.
Definition RandomGenerator.h:42
This class implements a vector with shifted elements.
Definition ShiftVector.h:27
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition SmartObjectRef.h:90
FramePyramidTrackerComponent(FrameTracker &tracker)
Creates a new component object.
IterationResult
Definition of individual results for the component iterations.
Definition FrameTracker.h:62
FrameTracker()=default
Creates a new offline frame tracker object.
This class implements an event stack layer object that pushes the relative progress parameters on the...
Definition OfflineTracker.h:163
virtual OfflinePoses poses() const
Returns the currently determined poses of this tracker.
virtual Plane3 plane() const
Returns the plane of this tracker.
PlaneTracker()=default
Creates a new plane tracker object.
SLAMPlaneTracker & componentParent_
The parent tracker invoking this component.
Definition SLAMPlaneTracker.h:166
Homographies componentHomographies_
The determined homographies of this component.
Definition SLAMPlaneTracker.h:181
CV::FramePyramid componentInitialFramePyramid_
Frame pyramid of the initial frame.
Definition SLAMPlaneTracker.h:193
const Scalar componentMaxPlaneAngle_
The maximal angle between two plane normals so that these normals count as similar.
Definition SLAMPlaneTracker.h:172
Frame componentIntermediateHomographyFrame_
Intermediate homography frame.
Definition SLAMPlaneTracker.h:199
HomographyTrackerComponent(SLAMPlaneTracker &parent, const PinholeCamera &pinholeCamera, Plane3 &resultingPlane, const Scalar maxPlaneAngle=Numeric::deg2rad(5), PinholeCamera *optimizedCamera=nullptr)
Creates a new homography tracking component object.
const PinholeCamera componentCamera_
The camera profile that is applied in this component.
Definition SLAMPlaneTracker.h:169
NormalPairs componentNormalPairs_
The determined pairs of plane normals, one pair for each detected homography.
Definition SLAMPlaneTracker.h:184
ImagePointsPairs componentImagePointsPairs_
The set of pairs of image points that have been used to determine the individual homographies.
Definition SLAMPlaneTracker.h:178
std::pair< Vector3, Vector3 > NormalPair
Definition of a pair of normals.
Definition SLAMPlaneTracker.h:74
bool determinePlaneCandidates(NormalPair &candidatePair, const Scalar maxAngle, const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex)
Determines the two best matching plane candidates from the set of plane normals pairs that have been ...
bool optimizeCamera(PinholeCamera &optimizedCamera, const unsigned int numberFrames=10u)
Optimizes the camera profile that has been used to track the homography and to create the initial pla...
ShiftVector< NormalPair > NormalPairs
Definition of a shift vector holding normal pairs.
Definition SLAMPlaneTracker.h:79
bool optimizeHomography(const CV::FramePyramid &previousFramePyramid, const Frame ¤tFrame, const CV::SubRegion &previousSubRegion, const SquareMatrix3 &homography, SquareMatrix3 &optimizedHomography, Vectors2 &previousImagePoints, Vectors2 ¤tImagePoints, Worker *worker=nullptr)
Optimizes the homography between two frames.
bool frame2frameHomography(const CV::FramePyramid &previousFramePyramid, const CV::FramePyramid ¤tFramePyramid, const CV::SubRegion &previousSubRegion, SquareMatrix3 &homography, Worker *worker=nullptr)
Determines an initial homography for a planar sub-region between two frames.
IterationResult onFrame(const unsigned int previousIndex, const unsigned int currentIndex, const unsigned int iteration, const unsigned int maximalIterations) override
Applies one component step.
ScopedEventStackLayer componentScopedEventLayer_
The progress event stack layer of this component.
Definition SLAMPlaneTracker.h:202
CV::FramePyramid componentIntermediateFramePyramid_
Intermediate frame pyramid.
Definition SLAMPlaneTracker.h:196
~HomographyTrackerComponent() override
Destructor.
Definition SLAMPlaneTracker.h:512
bool onStop(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex) override
Component start event function.
PinholeCamera * componentResultingOptimizedCamera_
Optional resulting optimized camera profile.
Definition SLAMPlaneTracker.h:190
RandomGenerator componentRandomGenerator_
Random number generator.
Definition SLAMPlaneTracker.h:175
Plane3 & componentResultingPlane_
Resulting plane.
Definition SLAMPlaneTracker.h:187
bool onStart(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex) override
Component start event function.
bool optimizePlane(Plane3 &optimizedPlane, const unsigned int numberFrames=10u)
Optimizes the plane.
~PlaneTrackerComponent() override
Destructor.
Definition SLAMPlaneTracker.h:522
const Plane3 & componentPlane_
Plane that is be used for tracking.
Definition SLAMPlaneTracker.h:375
const PinholeCamera & componentCamera_
The camera profile that is applied for tracking.
Definition SLAMPlaneTracker.h:369
const bool componentCreateStateEvents_
Statement whether this component creates state events for the individual poses.
Definition SLAMPlaneTracker.h:378
OfflinePoses * componentResultingPoses_
Optional resulting poses.
Definition SLAMPlaneTracker.h:384
bool optimizePose(const CV::FramePyramid &previousFramePyramid, const Frame ¤tFrame, const CV::SubRegion &previousSubRegion, const HomogenousMatrix4 &previousPose, const HomogenousMatrix4 ¤tPose, HomogenousMatrix4 &optimizedPose, Vectors2 &previousImagePoints, Vectors2 ¤tImagePoints, Worker *worker=nullptr)
Optimizes the pose for a given frame.
Frame componentIntermediateHomographyFrame_
Intermediate homography frame.
Definition SLAMPlaneTracker.h:402
SLAMPlaneTracker & componentParent_
Parent tracker that invokes this component.
Definition SLAMPlaneTracker.h:366
Homographies componentHomographies_
Homographies that are detected during tracking, each homography is defined in relation to the initial...
Definition SLAMPlaneTracker.h:387
bool onStop(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex) override
Component start event function.
const HomogenousMatrix4 & componentInitialPose_
The initial pose that is used for the initial frame.
Definition SLAMPlaneTracker.h:372
CV::FramePyramid componentIntermediateFramePyramid_
Intermediate frame pyramid.
Definition SLAMPlaneTracker.h:399
CV::FramePyramid componentInitialFramePyramid_
Frame pyramid of the initial frame.
Definition SLAMPlaneTracker.h:396
Plane3 * componentResultingPlane_
Optional resulting optimized plane.
Definition SLAMPlaneTracker.h:381
PlaneTrackerComponent(SLAMPlaneTracker &parent, const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &initialPose, const Plane3 &plane, const bool createStateEvents, OfflinePoses *poses, Plane3 *optimizedPlane)
Creates a new component object.
bool onStart(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex) override
Component start event function.
OfflinePoses componentPoses_
The camera poses that are detected during tracking, one pose for each frame.
Definition SLAMPlaneTracker.h:390
IterationResult onFrame(const unsigned int previousIndex, const unsigned int currentIndex, const unsigned int iteration, const unsigned int maximalIterations) override
Applies one component step.
ImagePointsPairs componentImagePointsPairs_
The set of pairs of image points that have been used to determine the individual poses.
Definition SLAMPlaneTracker.h:393
SLAMPlaneTracker & componentParent_
Parent tracker that invokes this component.
Definition SLAMPlaneTracker.h:254
Vectors2 componentPreviousImagePoints_
The image points of the previous frame.
Definition SLAMPlaneTracker.h:290
const CV::SubRegion & componentInitialSubRegion_
Initial sub-region defining the planar area in the initial frame.
Definition SLAMPlaneTracker.h:275
const PinholeCamera componentCamera_
The camera profile that is applied.
Definition SLAMPlaneTracker.h:257
Vectors3 componentInitialObjectPoints_[2]
Initial object points lying on the 3D plane, individual for each plane candidate.
Definition SLAMPlaneTracker.h:281
HomogenousMatrix4 componentPreviousPoses_[2]
Two previous camera poses, individual for each plane candidate.
Definition SLAMPlaneTracker.h:263
Plane3 & componentResultingPlane_
Resulting valid plane.
Definition SLAMPlaneTracker.h:287
bool onStop(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex) override
Component start event function.
Vectors2 componentCurrentImagePoints_
The image points of the current frame.
Definition SLAMPlaneTracker.h:293
~ValidPlaneIdentifyComponent() override
Destructor.
Definition SLAMPlaneTracker.h:517
const Scalar componentMaximalSqrDistance_
Maximal square distance between a projected 3D plane object point and a visible camera image point.
Definition SLAMPlaneTracker.h:284
Vectors2 componentInitialImagePoints_
Initial image points lying within the planar area in the initial frame.
Definition SLAMPlaneTracker.h:278
bool onStartDecreasing() override
Component decreasing start event function.
const HomogenousMatrix4 & componentInitialPose_
Initial camera pose for the frame index for that the tracking starts.
Definition SLAMPlaneTracker.h:260
Vectors3 componentObjectPoints_[2]
3D plane object points, individual for each plane candidate.
Definition SLAMPlaneTracker.h:272
unsigned int componentValidCorrespondences_[2]
The number of valid point correspondences, individual for each plane candidate.
Definition SLAMPlaneTracker.h:266
IterationResult onFrame(const unsigned int previousIndex, const unsigned int currentIndex, const unsigned int iteration, const unsigned int maximalIterations) override
Applies one component step.
Plane3 componentPlaneCandidates_[2]
Two plane candidates, one is correct.
Definition SLAMPlaneTracker.h:269
ValidPlaneIdentifyComponent(SLAMPlaneTracker &parent, const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &initialPose, const Plane3 planeCandidates[2], const CV::SubRegion &initialSubRegion, Plane3 &resultingPlane, const Scalar maximalSqrDistance=Scalar(3 *3))
Creates a new component object.
This class implements a SLAM tracker.
Definition SLAMPlaneTracker.h:49
bool determinePlane(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex)
Determines an initial plane.
bool optimizePlane(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex)
Optimizes the initial plane.
~SLAMPlaneTracker() override
Destructs a tracker object.
ShiftVector< SquareMatrix3 > Homographies
Definition of a shift vector holding homographies.
Definition SLAMPlaneTracker.h:55
CV::SubRegion initialSubRegion_
The user-defined sub-region for the initial tracking frame.
Definition SLAMPlaneTracker.h:509
bool setInitialTrackingArea(const Frame &yMask)
Sets an initial tracking area defined by a set of 2D triangles located in the initial camera frame.
const HomogenousMatrix4 initialPose_
The initial pose that is defined for the first frame index, this pose is the default pose: locking to...
Definition SLAMPlaneTracker.h:506
bool applyFrameTracking(const FrameType &frameType) override
Frame tracker run function.
bool updateObjectTransformation()
Updates the tracker object transformation using the current camera profile and plane of this tracker.
bool trackPlane(const PinholeCamera &pinholeCamera, const Plane3 &plane, const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex, const bool createStateEvents, Plane3 *optimizedPlane=nullptr, OfflinePoses *poses=nullptr)
Tracks a known plane and can determines the camera poses or/and optimize the plane.
SLAMPlaneTracker()
Creates a new tracker object.
ShiftVector< Geometry::NonLinearOptimizationPlane::ImagePointsPair > ImagePointsPairs
Definition of a shift vector holding image point pairs.
Definition SLAMPlaneTracker.h:60
void updatePlane(const Plane3 &plane) override
Updates the plane of this tracker and invokes the corresponding state event(s).
bool setInitialTrackingArea(const Triangles2 &triangles)
Sets an initial tracking area defined by a set of 2D triangles located in the initial camera frame.
bool determineInitialPlane(const PinholeCamera &pinholeCamera, const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex, Plane3 &optimizedPlane, PinholeCamera *optimizedCamera=nullptr)
Determines an initial plane.
void updateCamera(const PinholeCamera &pinholeCamera) override
Updates the camera of this tracker and invokes the corresponding state event(s).
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
std::vector< Vector2 > Vectors2
Definition of a vector holding Vector2 objects.
Definition Vector2.h:64
PlaneT3< Scalar > Plane3
Definition of the Plane3 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single ...
Definition Plane3.h:31
PinholeCameraT< Scalar > PinholeCamera
Definition of an pinhole camera object with Scalar precision.
Definition PinholeCamera.h:39
HomogenousMatrixT4< Scalar > HomogenousMatrix4
Definition of the HomogenousMatrix4 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION flag eit...
Definition HomogenousMatrix4.h:44
SquareMatrixT3< Scalar > SquareMatrix3
Definition of the SquareMatrix3 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with ...
Definition SquareMatrix3.h:43
std::vector< Triangle2 > Triangles2
Definition of a vector holding 2D triangles.
Definition Triangle2.h:57
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition Vector3.h:65
float Scalar
Definition of a scalar type.
Definition Math.h:129
ShiftVector< OfflinePose > OfflinePoses
Definition of a shift vector holding offline poses.
Definition OfflinePose.h:33
SmartObjectRef< SLAMPlaneTracker, OfflineTracker > SLAMPlaneTrackerRef
Definition of an object reference holding a SLAMPlaneTracker object.
Definition SLAMPlaneTracker.h:40
Namespace of the Offline Tracker library.
Definition offline/Frame2FrameTracker.h:31
Namespace of the Tracker library.
The namespace covering the entire Ocean framework.
Definition Accessor.h:15