8 #ifndef META_OCEAN_TRACKING_OFFLINE_POINT_PATHS_H
9 #define META_OCEAN_TRACKING_OFFLINE_POINT_PATHS_H
64 TM_FIXED_PATCH_SIZE_31
89 inline TrackingConfiguration(
const TrackingMethod trackingMethod,
const unsigned int frameWidth,
const unsigned int frameHeight,
const unsigned int numberBins,
const unsigned int strength,
const unsigned int coarsestLayerRadius,
const unsigned int pyramidLayers);
100 inline TrackingConfiguration(
const TrackingMethod trackingMethod,
const unsigned int horizontalBinSize,
const unsigned int verticalBinSize,
const unsigned int strength,
const unsigned int coarsestLayerRadius,
const unsigned int pyramidLayers);
113 inline unsigned int horizontalBinSize()
const;
120 inline unsigned int verticalBinSize()
const;
126 inline unsigned int strength()
const;
132 inline unsigned int coarsestLayerRadius()
const;
138 inline unsigned int pyramidLayers()
const;
146 inline unsigned int horizontalBins(
const unsigned int areaWidth,
const unsigned int minimalBins)
const;
154 inline unsigned int verticalBins(
const unsigned int areaHeight,
const unsigned int minimalBins)
const;
171 inline bool isValid()
const;
179 unsigned int horizontalBinSize_ = 0u;
182 unsigned int verticalBinSize_ = 0u;
185 unsigned int strength_ = 0u;
188 unsigned int pyramidLayers_ = 0u;
191 unsigned int coarsestLayerRadius_ = 0u;
231 static bool determinePointPaths(
CV::FrameProviderInterface& frameProviderInterface,
const FrameType::PixelFormat pixelFormat,
const FrameType::PixelOrigin pixelOrigin,
const TrackingConfiguration& trackingConfiguration,
const unsigned int lowerFrameIndex,
const unsigned int startFrameIndex,
const unsigned int upperFrameIndex,
const unsigned int invalidBorderSize,
const bool onlyNewObjectPoints,
Database& database,
Worker* worker =
nullptr,
bool* abort =
nullptr,
Scalar* progress =
nullptr);
252 static bool determinePointPaths(
CV::FrameProviderInterface& frameProviderInterface,
const FrameType::PixelFormat pixelFormat,
const FrameType::PixelOrigin pixelOrigin,
const TrackingConfiguration& trackingConfiguration,
const unsigned int lowerFrameIndex,
const CV::SubRegion& subRegion,
const unsigned int subRegionFrameIndex,
const unsigned int upperFrameIndex,
const unsigned int invalidBorderSize,
const bool onlyNewObjectPoints,
Database& database,
Worker* worker =
nullptr,
bool* abort =
nullptr,
Scalar* progress =
nullptr);
308 static void idealPyramidParameters(
const unsigned int width,
const unsigned int height,
const MotionSpeed motionSpeed,
unsigned int& coarsestLayerRadius,
unsigned int& layers,
const unsigned int maximalCoarsestLayerRadius = 26u,
const unsigned int maximalLayers = (
unsigned int)(-1));
329 trackingMethod_(trackingMethod),
330 horizontalBinSize_(0u),
331 verticalBinSize_(0u),
333 pyramidLayers_(pyramidLayers),
334 coarsestLayerRadius_(coarsestLayerRadius)
336 const unsigned int maxValue = max(frameWidth, frameHeight);
338 ocean_assert(numberBins != 0u);
349 trackingMethod_(trackingMethod),
350 horizontalBinSize_(horizontalBinSize),
351 verticalBinSize_(verticalBinSize),
353 pyramidLayers_(pyramidLayers),
354 coarsestLayerRadius_(coarsestLayerRadius)
361 return trackingMethod_;
366 return horizontalBinSize_;
371 return verticalBinSize_;
381 return coarsestLayerRadius_;
386 return pyramidLayers_;
391 ocean_assert(areaWidth >= 1u);
393 if (horizontalBinSize_ == 0u)
398 return max(minimalBins, (areaWidth + horizontalBinSize_ / 2u) / horizontalBinSize_);
403 ocean_assert(areaHeight >= 1u);
405 if (verticalBinSize_ == 0u)
410 return max(minimalBins, (areaHeight + verticalBinSize_ / 2u) / verticalBinSize_);
415 return trackingMethod_ !=
TM_INVALID && coarsestLayerRadius_ != 0u && pyramidLayers_ != 0u;
This class defines an abstract interface allowing to request frames from any kind of frame provider.
Definition: FrameProviderInterface.h:38
This class implements a frame pyramid.
Definition: FramePyramid.h:37
This class implement a sub-region either defined by 2D triangles or defined by a binary mask.
Definition: SubRegion.h:32
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition: Frame.h:183
PixelOrigin
Defines different types of frame origin positions.
Definition: Frame.h:1046
This class implements a database for 3D object points, 2D image points and 6DOF camera poses.
Definition: Database.h:67
TrackingQuality
Definition of individual tracking qualities.
Definition: OfflineTracker.h:54
Definition of a class holding a point tracking configuration.
Definition: PointPaths.h:71
unsigned int coarsestLayerRadius() const
Returns the search radius on the coarsest pyramid layer in pixel.
Definition: PointPaths.h:379
TrackingConfiguration()=default
Creates an invalid tracking configuration object.
unsigned int verticalBins(const unsigned int areaHeight, const unsigned int minimalBins) const
Returns the number of vertical bins that are necessary if this configuration is applied to a given fr...
Definition: PointPaths.h:401
unsigned int horizontalBinSize() const
Returns the horizontal bin size of this configuration.
Definition: PointPaths.h:364
unsigned int horizontalBins(const unsigned int areaWidth, const unsigned int minimalBins) const
Returns the number of horizontal bins that are necessary if this configuration is applied to a given ...
Definition: PointPaths.h:389
unsigned int verticalBinSize() const
Returns the vertical bin size of this configuration.
Definition: PointPaths.h:369
unsigned int strength() const
Returns the minimal strength parameter of this configuration.
Definition: PointPaths.h:374
unsigned int pyramidLayers() const
Returns the number of pyramid layers of this configuration.
Definition: PointPaths.h:384
TrackingMethod trackingMethod() const
Returns the tracking method of this configuration.
Definition: PointPaths.h:359
unsigned int pyramidLayers_
The number of pyramid layers of this configuration, with range [2, infinity) if valid.
Definition: PointPaths.h:188
unsigned int verticalBinSize_
The vertical bin size of this configuration.
Definition: PointPaths.h:182
bool weakenConfiguration(const Scalar binSizeFactor=Scalar(0.5), const Scalar strengthFactor=Scalar(0.5), const unsigned int minimalBinSize=0u, const unsigned int minimalStrength=0u)
Weakens the tracking configurations so that more feature points will be used for tracking while the t...
unsigned int horizontalBinSize_
The horizontal bin size of this configuration.
Definition: PointPaths.h:179
bool isValid() const
Returns whether this configuration object is valid.
Definition: PointPaths.h:413
unsigned int coarsestLayerRadius_
The search radius on the coarsest pyramid layers, with range [1, infinity) if valid.
Definition: PointPaths.h:191
This class implements point path tracker allowing to track image points from frame to frame within a ...
Definition: PointPaths.h:36
std::vector< TrackingConfigurationPair > TrackingConfigurationPairs
Definition of a vector holding TrackingConfigurationPair objects.
Definition: PointPaths.h:204
static bool determinePointPaths(CV::FrameProviderInterface &frameProviderInterface, const FrameType::PixelFormat pixelFormat, const FrameType::PixelOrigin pixelOrigin, const TrackingConfiguration &trackingConfiguration, const unsigned int lowerFrameIndex, const unsigned int startFrameIndex, const unsigned int upperFrameIndex, const unsigned int invalidBorderSize, const bool onlyNewObjectPoints, Database &database, Worker *worker=nullptr, bool *abort=nullptr, Scalar *progress=nullptr)
Tracks reliable points between successive frames and joins points paths to a common/shared object poi...
static void idealPyramidParameters(const unsigned int width, const unsigned int height, const MotionSpeed motionSpeed, unsigned int &coarsestLayerRadius, unsigned int &layers, const unsigned int maximalCoarsestLayerRadius=26u, const unsigned int maximalLayers=(unsigned int)(-1))
Determines the number of necessary pyramid layers and coarsest layer radius for a specified frame dim...
static bool determineAutomaticTrackingConfiguration(CV::FrameProviderInterface &frameProviderInterface, const FrameType::PixelOrigin pixelOrigin, const MotionSpeed motionSpeed, const unsigned int frameIndex, const CV::SubRegion ®ionOfInterest, TrackingConfiguration *frameTrackingConfiguration, TrackingConfiguration *regionOfInterestTrackingConfiguration, Worker *worker=nullptr, bool *abort=nullptr)
Determines the best matching tracking configuration for the point tracker starting at a specific fram...
MotionSpeed
Definition of individual camera motion speeds.
Definition: PointPaths.h:43
@ MS_SLOW
A slow motion of the camera.
Definition: PointPaths.h:45
@ MS_MODERATE
A moderate motion of the camera.
Definition: PointPaths.h:47
std::vector< int > Strengths
Definition of a vector holding strength parameters.
Definition: PointPaths.h:209
std::pair< TrackingConfiguration, unsigned int > TrackingConfigurationPair
Definition of a pair combining a tracker configuration and a ratio value.
Definition: PointPaths.h:199
static bool trackPoints(const CV::FramePyramid &previousFramePyramid, const CV::FramePyramid ¤tFramePyramid, const unsigned int coarsestLayerRadius, const Strengths &previousFeatureStrengths, const TrackingMethod trackingMethod, Vectors2 &previousFeaturePoints, Vectors2 ¤tFeaturePoints, Indices32 &validIndices, Worker *worker)
Applies a bidirectional tracking of points between to frames.
static bool determineTrackingConfiguration(CV::FrameProviderInterface &frameProviderInterface, const CV::SubRegion ®ionOfInterest, const OfflineTracker::TrackingQuality trackingQuality, const MotionSpeed motionSpeed, TrackingConfiguration *frameTrackingConfiguration, TrackingConfiguration *regionOfInterestTrackingConfiguration, bool *abort=nullptr)
Determines the tracking configuration for an explicit specified tracking quality.
static bool determineAutomaticTrackingConfiguration(CV::FrameProviderInterface &frameProviderInterface, const FrameType::PixelOrigin pixelOrigin, const MotionSpeed motionSpeed, const unsigned int lowerFrameIndex, const unsigned int upperFrameIndex, TrackingConfiguration &frameTrackingConfiguration, const unsigned int intermediateFrames=5u, Worker *worker=nullptr, bool *abort=nullptr)
Determines the best matching tracking configuration for the point tracker tracking frames within a sp...
TrackingMethod
Definition of individual tracking methods.
Definition: PointPaths.h:56
@ TM_INVALID
Invalid tracking method.
Definition: PointPaths.h:58
@ TM_FIXED_PATCH_SIZE_15
Using a patch with size 15.
Definition: PointPaths.h:62
@ TM_FIXED_PATCH_SIZE_7
Using a patch with size 7.
Definition: PointPaths.h:60
static bool determinePointPaths(CV::FrameProviderInterface &frameProviderInterface, const FrameType::PixelFormat pixelFormat, const FrameType::PixelOrigin pixelOrigin, const TrackingConfiguration &trackingConfiguration, const unsigned int lowerFrameIndex, const CV::SubRegion &subRegion, const unsigned int subRegionFrameIndex, const unsigned int upperFrameIndex, const unsigned int invalidBorderSize, const bool onlyNewObjectPoints, Database &database, Worker *worker=nullptr, bool *abort=nullptr, Scalar *progress=nullptr)
Tracks reliable points between successive frames starting at a specific frame in a specific sub-regio...
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
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< Vector2 > Vectors2
Definition of a vector holding Vector2 objects.
Definition: Vector2.h:64
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15