8#ifndef META_OCEAN_TRACKING_OFFLINE_PATTERN_TRACKER_H
9#define META_OCEAN_TRACKING_OFFLINE_PATTERN_TRACKER_H
86 unsigned int patternId_ = (
unsigned int)(-1);
118 IterationResult onFrame(
const unsigned int previousIndex,
const unsigned int currentIndex,
const unsigned int iteration,
const unsigned int maximalIterations)
override;
124 bool onStop(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex)
override;
132 unsigned int frameNumber_ = 0u;
171 bool onStart(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex)
override;
177 IterationResult onFrame(
const unsigned int previousIndex,
const unsigned int currentIndex,
const unsigned int iteration,
const unsigned int maximalIterations)
override;
183 bool onStop(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex)
override;
226 bool onStart(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex)
override;
232 IterationResult onFrame(
const unsigned int previousIndex,
const unsigned int currentIndex,
const unsigned int iteration,
const unsigned int maximalIterations)
override;
238 bool onStop(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex)
override;
271 bool optimizePose(
const PinholeCamera& pinholeCamera,
const HomogenousMatrix4& pose,
const Frame& frame,
const Frame& patternLayer,
const unsigned int detectionBorder,
const unsigned int horizontalBinSize,
const unsigned int verticalBinSize,
ImagePoints& imagePoints,
ObjectPoints& objectPoints,
HomogenousMatrix4& optimizedPose,
Worker* worker =
nullptr);
283 bool optimizeCamera(
const PinholeCamera& pinholeCamera,
const unsigned int numberFrames,
const unsigned int iterations,
const unsigned int lowerFrameIndex,
const unsigned int upperFrameIndex,
PinholeCamera& optimizedCamera);
300 const unsigned int iterations_ = 0u;
303 const unsigned int detectionBorder_ = 0u;
306 const unsigned int horizontalBinSize_ = 0u;
309 const unsigned int verticalBinSize_ = 0u;
335 inline Vector2 patternDimension()
const;
367 bool determineRoughCameraFov(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex,
const unsigned int cameraFovDeterminationFrames = 10u);
376 bool determineRoughPoses(
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex);
385 bool closeGaps(
const unsigned int lowerFrameIndex,
const unsigned int upperFrameIndex,
const unsigned int minimalCorrespondences = 50u);
398 bool fineAdjustment(
const unsigned iterations,
const unsigned int detectionBorder,
const unsigned int horizontalBinSize,
const unsigned int verticalBinSize,
const bool optimizeCamera,
const unsigned int lowerFrameIndex,
const unsigned int initialFrameIndex,
const unsigned int upperFrameIndex);
This class implements a frame pyramid.
Definition FramePyramid.h:37
This class implements Ocean's image class.
Definition Frame.h:1808
Definition of a frame type composed by the frame dimension, pixel format and pixel origin.
Definition Frame.h:30
This class implements a scoped lock object for recursive lock objects.
Definition Lock.h:135
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition SmartObjectRef.h:90
This class implements the base class for all components of a frame tracker.
Definition FrameTracker.h:155
IterationResult
Definition of individual results for the component iterations.
Definition FrameTracker.h:62
This class implements the base class for all visual offline tracker using frames to provide the track...
Definition FrameTracker.h:46
Lock lock_
Tracker lock object.
Definition OfflineTracker.h:428
This class implements a tracking component that allows to determine an accurate pose and that further...
Definition PatternTracker.h:198
bool optimizePose(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, const Frame &frame, const Frame &patternLayer, const unsigned int detectionBorder, const unsigned int horizontalBinSize, const unsigned int verticalBinSize, ImagePoints &imagePoints, ObjectPoints &objectPoints, HomogenousMatrix4 &optimizedPose, Worker *worker=nullptr)
Optimizes a pose due to accurate 2D/3D point correspondences.
IterationResult onFrame(const unsigned int previousIndex, const unsigned int currentIndex, const unsigned int iteration, const unsigned int maximalIterations) override
Applies one component step.
const PinholeCamera camera_
The camera profile that will be applied.
Definition PatternTracker.h:291
~FineTrackingComponent() override
Destructor.
Definition PatternTracker.h:450
bool onStart(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex) override
Component start event function.
bool onStop(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex) override
Component stop event function.
OfflinePoses & optimizedPoses_
Resulting optimized poses for each frame.
Definition PatternTracker.h:312
FineTrackingComponent(PatternTracker &parent, const PinholeCamera &pinholeCamera, const OfflinePoses &poses, const unsigned int iterations, const unsigned int detectionBorder, const unsigned int horizontalBinSize, const unsigned int verticalBinSize, OfflinePoses &optimizedPoses, PinholeCamera *optimizedCamera)
Creates a new fine tracking component.
ShiftVector< ImagePoints > imagePointsSet_
The set of image points that are used for pose determination, one set for each frame.
Definition PatternTracker.h:318
CV::FramePyramid patternFramePyramid_
The frame pyramid of the pattern image.
Definition PatternTracker.h:294
bool optimizePose(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, const Frame &frame, const unsigned int detectionBorder, const unsigned int horizontalBinSize, const unsigned int verticalBinSize, ImagePoints &imagePoints, ObjectPoints &objectPoints, HomogenousMatrix4 &optimizedPose, Worker *worker=nullptr)
Optimizes a pose due to accurate 2D/3D point correspondences.
PatternTracker & parent_
The parent tracker invoking this component.
Definition PatternTracker.h:288
ShiftVector< ObjectPoints > objectPointsSet_
The set of object points that are used for pose determination, one set for each frame.
Definition PatternTracker.h:321
const OfflinePoses & poses_
Already known poses for each frame.
Definition PatternTracker.h:297
bool optimizeCamera(const PinholeCamera &pinholeCamera, const unsigned int numberFrames, const unsigned int iterations, const unsigned int lowerFrameIndex, const unsigned int upperFrameIndex, PinholeCamera &optimizedCamera)
Optimizes the camera profile due to the determined 2D/3D point correspondences.
This class implements a tracking component that determines a rough guess of the horizontal field of v...
Definition PatternTracker.h:95
RoughCameraFovComponent(PatternTracker &parent, const PinholeCamera &pinholeCamera, Scalar &resultingFovX, const unsigned int frameNumber)
Creates a new component object.
Scalar & resultingFovX_
The resulting horizontal field of view.
Definition PatternTracker.h:129
bool onStop(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex) override
Component start event function.
IterationResult onFrame(const unsigned int previousIndex, const unsigned int currentIndex, const unsigned int iteration, const unsigned int maximalIterations) override
Applies one component step.
Geometry::ObjectPointGroups objectPointGroups_
The groups of object points that are extracted in the first frames.
Definition PatternTracker.h:138
HomogenousMatrices4 poses_
The extracted camera poses.
Definition PatternTracker.h:141
~RoughCameraFovComponent() override
Destructor.
Definition PatternTracker.h:440
Geometry::ImagePointGroups imagePointGroups_
The groups of image points that are extracted in the first frames.
Definition PatternTracker.h:135
This class implements the base class for all tracking components providing a rough pose.
Definition PatternTracker.h:59
const PinholeCamera camera_
The camera profile that will be applied.
Definition PatternTracker.h:80
RoughPoseBaseComponent(PatternTracker &parent, const PinholeCamera &pinholeCamera)
Creates a new rough tracking component.
PatternTracker & parent_
The parent tracker invoking this component.
Definition PatternTracker.h:77
Pattern::PatternTracker6DOF subTracker_
The tracker determining the rough poses.
Definition PatternTracker.h:83
~RoughPoseBaseComponent() override
Destructor.
Definition PatternTracker.h:435
This class implements a tracking component that determines rough camera poses by application of 2D / ...
Definition PatternTracker.h:149
OfflinePoses & resultingPoses_
The resulting rough poses that will be determined.
Definition PatternTracker.h:188
~RoughPoseComponent() override
Destructor.
Definition PatternTracker.h:445
bool onStop(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex) override
Component stop event function.
OfflinePoses poses_
The internal rough poses that will be determined.
Definition PatternTracker.h:191
bool onStart(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex) override
Component start event function.
IterationResult onFrame(const unsigned int previousIndex, const unsigned int currentIndex, const unsigned int iteration, const unsigned int maximalIterations) override
Applies one component step.
RoughPoseComponent(PatternTracker &parent, const PinholeCamera &pinholeCamera, OfflinePoses &resultingPoses)
Creates a new tracking component object.
This class implements an offline tracker able to detect and track a previously known 2D pattern.
Definition PatternTracker.h:51
bool setCamera(const PinholeCamera &pinholeCamera, const Scalar cameraPrecision, const bool optimizeCamera) override
Sets a camera object that will be used by this tracker.
Triangles2 projectedPatternTriangles(const HomogenousMatrix4 &pose, const PinholeCamera &pinholeCamera) const
Returns projected 2D triangles that cover the area of the 3D tracking pattern.
bool applyFrameTracking(const FrameType &frameType) override
Frame tracker run function.
bool determineRoughCameraFov(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex, const unsigned int cameraFovDeterminationFrames=10u)
Guesses the rough field of view of the camera.
Frame patternFrame_
The frame pattern that is tracked during the video stream.
Definition PatternTracker.h:426
Scalar projectedPatternArea(const HomogenousMatrix4 &pose, const PinholeCamera &pinholeCamera) const
Calculates the projection area of the defined 3D object pattern.
Vector2 patternDimension_
Dimension of the frame pattern in meter.
Definition PatternTracker.h:429
bool determineRoughPoses(const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex)
Determines the initial rough poses for the entire video stream.
bool setPattern(const Frame &frame, const Vector2 &dimension)
Sets the tracking pattern that will be tracked in the video stream.
bool fineAdjustment(const unsigned iterations, const unsigned int detectionBorder, const unsigned int horizontalBinSize, const unsigned int verticalBinSize, const bool optimizeCamera, const unsigned int lowerFrameIndex, const unsigned int initialFrameIndex, const unsigned int upperFrameIndex)
Applies a fine adjustment of the camera poses.
Vector2 patternDimension() const
Returns the current dimension of the tracking pattern.
Definition PatternTracker.h:455
PatternTracker()
Creates a new pattern tracker object.
bool updatePatternDimension(const Vector2 &dimension)
Updates the pattern dimension of this tracker and invokes the corresponding state event(s).
bool closeGaps(const unsigned int lowerFrameIndex, const unsigned int upperFrameIndex, const unsigned int minimalCorrespondences=50u)
Closes the tracking gaps (break-downs) for the provided video stream.
This class implements the abstract base class for all plane trackers.
Definition PlaneTracker.h:42
This class implements a 6DOF feature tracker for planar patterns.
Definition tracking/pattern/PatternTracker6DOF.h:34
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
std::vector< ObjectPoints > ObjectPointGroups
Definition of a vector holding object points, so we have groups of object points.
Definition geometry/Geometry.h:135
std::vector< ImagePoints > ImagePointGroups
Definition of a vector holding image points, so we have groups of image points.
Definition geometry/Geometry.h:141
float Scalar
Definition of a scalar type.
Definition Math.h:129
std::vector< HomogenousMatrix4 > HomogenousMatrices4
Definition of a vector holding HomogenousMatrix4 objects.
Definition HomogenousMatrix4.h:73
std::vector< Triangle2 > Triangles2
Definition of a vector holding 2D triangles.
Definition Triangle2.h:57
std::vector< ObjectPoint > ObjectPoints
Definition of a vector holding 3D object points.
Definition Tracking.h:61
std::vector< ImagePoint > ImagePoints
Definition of a vector holding 2D image points.
Definition Tracking.h:55
SmartObjectRef< PatternTracker, OfflineTracker > PatternTrackerRef
Definition of a smart object reference holding a PatternTracker object.
Definition PatternTracker.h:39
The namespace covering the entire Ocean framework.
Definition Accessor.h:15