Ocean
PointPaths.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_OFFLINE_POINT_PATHS_H
9 #define META_OCEAN_TRACKING_OFFLINE_POINT_PATHS_H
10 
13 
15 #include "ocean/cv/FramePyramid.h"
16 #include "ocean/cv/SubRegion.h"
17 
18 #include "ocean/math/Vector2.h"
19 
21 
22 namespace Ocean
23 {
24 
25 namespace Tracking
26 {
27 
28 namespace Offline
29 {
30 
31 /**
32  * This class implements point path tracker allowing to track image points from frame to frame within a stream of several successive frames.
33  * @ingroup trackingoffline
34  */
35 class OCEAN_TRACKING_OFFLINE_EXPORT PointPaths
36 {
37  public:
38 
39  /**
40  * Definition of individual camera motion speeds.
41  */
43  {
44  /// A slow motion of the camera.
46  /// A moderate motion of the camera.
48  /// A fast motion of the camera.
49  MS_FAST
50  };
51 
52  /**
53  * Definition of individual tracking methods.
54  */
56  {
57  /// Invalid tracking method.
59  /// Using a patch with size 7.
61  /// Using a patch with size 15.
63  /// Using a patch with size 31.
64  TM_FIXED_PATCH_SIZE_31
65  };
66 
67  /**
68  * Definition of a class holding a point tracking configuration.
69  */
71  {
72  public:
73 
74  /**
75  * Creates an invalid tracking configuration object.
76  */
77  TrackingConfiguration() = default;
78 
79  /**
80  * Creates a new tracking configuration object.
81  * @param trackingMethod The tracking method to be used
82  * @param frameWidth The width of the frame in pixel, with range [1, infinity)
83  * @param frameHeight The height of the frame in pixel, with range [1, infinity)
84  * @param numberBins The number of the bins in horizontal or vertical direction depending on the larger value, with range [1, infinity)
85  * @param strength The minimal strength parameter for tracking points, with range [0, 256]
86  * @param coarsestLayerRadius The search radius on the coarsest pyramid layer in pixels, with range [2, infinity)
87  * @param pyramidLayers The number of pyramid layers, with range [1, infinity)
88  */
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);
90 
91  /**
92  * Creates a new tracking configuration object.
93  * @param trackingMethod The tracking method to be used
94  * @param horizontalBinSize The number of pixels per horizontal bin filtering tracking points before they are tracked, 0 to avoid any filtering
95  * @param verticalBinSize The number of pixels per vertical bin filtering tracking points before they are tracked, 0 to avoid any filtering
96  * @param strength The minimal strength parameter for tracking points, with range [0, 256]
97  * @param coarsestLayerRadius The search radius on the coarsest pyramid layer in pixels, with range [2, infinity)
98  * @param pyramidLayers The number of pyramid layers, with range [1, infinity)
99  */
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);
101 
102  /**
103  * Returns the tracking method of this configuration.
104  * @return The tracking method
105  */
106  inline TrackingMethod trackingMethod() const;
107 
108  /**
109  * Returns the horizontal bin size of this configuration.
110  * A tracking area with width 100 pixel and horizontal bin size 50 pixel will be tracked by application of two horizontal bins.
111  * @return The horizontal bin size, with range [1, infinity), 0 to avoid the application of bins
112  */
113  inline unsigned int horizontalBinSize() const;
114 
115  /**
116  * Returns the vertical bin size of this configuration.
117  * A tracking area with height 100 pixel and vertical bin size 50 pixel will be tracked by application of two vertical bins.
118  * @return The vertical bin size in pixel, with range [1, infinity), 0 to avoid the application of bins
119  */
120  inline unsigned int verticalBinSize() const;
121 
122  /**
123  * Returns the minimal strength parameter of this configuration.
124  * @return The minimal strength parameter, with range [0, infinity)
125  */
126  inline unsigned int strength() const;
127 
128  /**
129  * Returns the search radius on the coarsest pyramid layer in pixel.
130  * @return The radius on the coarsest pyramid layer, with range [2, infinity) if valid
131  */
132  inline unsigned int coarsestLayerRadius() const;
133 
134  /**
135  * Returns the number of pyramid layers of this configuration.
136  * @return The number of pyramid layers, with range [1, infinity) if valid
137  */
138  inline unsigned int pyramidLayers() const;
139 
140  /**
141  * Returns the number of horizontal bins that are necessary if this configuration is applied to a given frame or frame area.
142  * @param areaWidth The width of the area to which this configuration is applied, may be the width of an entire frame or the width of a sub-region, with range [1, infinity)
143  * @param minimalBins The minimal number of bins that will be returned (if bin-filtering is intended by this configuration)
144  * @return The number of horizontal bins, 0 if the application of bin-filtering is not intended by this configuration
145  */
146  inline unsigned int horizontalBins(const unsigned int areaWidth, const unsigned int minimalBins) const;
147 
148  /**
149  * Returns the number of vertical bins that are necessary if this configuration is applied to a given frame or frame area.
150  * @param areaHeight The height of the area to which this configuration is applied, may be the height of an entire frame or the height of a sub-region, with range [1, infinity)
151  * @param minimalBins The minimal number of bins that will be returned (if bin-filtering is intended by this configuration)
152  * @return The number of vertical bins, 0 if the application of bin-filtering is not intended by this configuration
153  */
154  inline unsigned int verticalBins(const unsigned int areaHeight, const unsigned int minimalBins) const;
155 
156  /**
157  * Weakens the tracking configurations so that more feature points will be used for tracking while the tracking will take longer.
158  * If the provided factor are larger than 1 the configuration will get stricter.
159  * @param binSizeFactor The factor which will be multiplied to the current horizontal and vertical bin sizes, with range (0, infinity)
160  * @param strengthFactor The factor which will be multiplied to the current strength value, with range (0, infinity)
161  * @param minimalBinSize Optional minimal bin size value ensuring that the weakened value does not drop below this threshold, with range [0, infinity)
162  * @param minimalStrength Optional minimal strength value ensuring that the weakened value does not drop below this threshold, with range [0, infinity)
163  * @return True, if the configuration value have been changed
164  */
165  bool weakenConfiguration(const Scalar binSizeFactor = Scalar(0.5), const Scalar strengthFactor = Scalar(0.5), const unsigned int minimalBinSize = 0u, const unsigned int minimalStrength = 0u);
166 
167  /**
168  * Returns whether this configuration object is valid.
169  * @return True, if so
170  */
171  inline bool isValid() const;
172 
173  private:
174 
175  /// The tracking method of this configuration.
176  TrackingMethod trackingMethod_ = TM_INVALID;
177 
178  /// The horizontal bin size of this configuration.
179  unsigned int horizontalBinSize_ = 0u;
180 
181  /// The vertical bin size of this configuration.
182  unsigned int verticalBinSize_ = 0u;
183 
184  /// The strength parameter of this configuration.
185  unsigned int strength_ = 0u;
186 
187  /// The number of pyramid layers of this configuration, with range [2, infinity) if valid
188  unsigned int pyramidLayers_ = 0u;
189 
190  /// The search radius on the coarsest pyramid layers, with range [1, infinity) if valid
191  unsigned int coarsestLayerRadius_ = 0u;
192  };
193 
194  protected:
195 
196  /**
197  * Definition of a pair combining a tracker configuration and a ratio value.
198  */
199  using TrackingConfigurationPair = std::pair<TrackingConfiguration, unsigned int>;
200 
201  /**
202  * Definition of a vector holding TrackingConfigurationPair objects.
203  */
204  using TrackingConfigurationPairs = std::vector<TrackingConfigurationPair>;
205 
206  /**
207  * Definition of a vector holding strength parameters.
208  */
209  using Strengths = std::vector<int>;
210 
211  public:
212 
213  /**
214  * Tracks reliable points between successive frames and joins points paths to a common/shared object points.
215  * Further, camera poses are registered for each camera frame (without the actual pose determination).<br>
216  * @param frameProviderInterface The frame provider interface which is used to extract the individual frames, must be valid and must be initialized
217  * @param pixelFormat The pixel format which is used for each frame
218  * @param pixelOrigin The pixel origin which is used for each frame
219  * @param trackingConfiguration The tracking configuration that is applied to track the points
220  * @param lowerFrameIndex The index of the lower frame which will be used for tracking
221  * @param startFrameIndex The index of the frame at which the determination of the point paths will start, with range [lowerFrameIndex, upperFrameIndex]
222  * @param upperFrameIndex The index of the upper frame which will be used for tracking, with range [lowerFrame, infinity)
223  * @param invalidBorderSize The border size at the outer frame border in which tracked points will count as invalid, in pixel, with range [0, min(width / 2, height / 2))
224  * @param onlyNewObjectPoints True, to add and track only object points which are not part of the database yet
225  * @param database The resulting database holding the object points, image points and camera poses after tracking, must be empty
226  * @param worker Optional worker object to distribute the computation
227  * @param abort Optional abort statement allowing to stop the execution; True, if the execution has to stop
228  * @param progress Optional resulting progress with range [0, 1]
229  * @return True, if succeeded
230  */
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);
232 
233  /**
234  * Tracks reliable points between successive frames starting at a specific frame in a specific sub-region.
235  * Successive tracked points will be joined to a path representing the same object point.
236  * @param frameProviderInterface The frame provider interface which is used to extract the individual frames, must be valid and must be initialized
237  * @param pixelFormat The pixel format which is used for each frame
238  * @param pixelOrigin The pixel origin which is used for each frame
239  * @param trackingConfiguration The tracking configuration that is applied to track the points
240  * @param lowerFrameIndex The index of the lower frame which will be used for tracking
241  * @param subRegion The sub-region defining a specific frame area in the start frame in which all reliable points will be tracked
242  * @param subRegionFrameIndex The index of the frame in which the sub-region is defined
243  * @param upperFrameIndex The index of the upper frame which will be used for tracking, with range [lowerFrame, infinity)
244  * @param invalidBorderSize The border size at the outer frame border in which tracked points will count as invalid, in pixel, with range [0, min(width / 2, height / 2))
245  * @param onlyNewObjectPoints True, to add and track only object points which are not part of the database yet
246  * @param database The resulting database holding the object points, image points and camera poses after tracking, must be empty
247  * @param worker Optional worker object to distribute the computation
248  * @param abort Optional abort statement allowing to stop the execution; True, if the execution has to stop
249  * @param progress Optional resulting progress with range [0, 1]
250  * @return True, if succeeded
251  */
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);
253 
254  /**
255  * Determines the tracking configuration for an explicit specified tracking quality.
256  * @param frameProviderInterface The frame provider interface providing the frame access
257  * @param regionOfInterest The optional region of interest for which the specific region-of-interest-configuration may be determined, an invalid region otherwise
258  * @param trackingQuality The tracking quality for which the tracking configuration will be determined
259  * @param motionSpeed The expected motion speed of the image content
260  * @param frameTrackingConfiguration The resulting tracking configuration for the entire frame, if defined
261  * @param regionOfInterestTrackingConfiguration The resulting tracking configuration for the specified region of interest, if defined and if a region of interest is defined
262  * @param abort Optional abort statement allowing to stop the execution; True, if the execution has to stop
263  * @return True, if succeeded
264  */
265  static bool determineTrackingConfiguration(CV::FrameProviderInterface& frameProviderInterface, const CV::SubRegion& regionOfInterest, const OfflineTracker::TrackingQuality trackingQuality, const MotionSpeed motionSpeed, TrackingConfiguration* frameTrackingConfiguration, TrackingConfiguration* regionOfInterestTrackingConfiguration, bool* abort = nullptr);
266 
267  /**
268  * Determines the best matching tracking configuration for the point tracker starting at a specific frame.
269  * The most suitable configuration can either be determined for the entire frame, for a specified region of interest or for both areas.
270  * @param frameProviderInterface The frame provider interface providing the frame access
271  * @param pixelOrigin The origin of the frame for which the configuration will be determined
272  * @param motionSpeed The expected motion speed of the image content
273  * @param frameIndex The index of the frame for which the configuration will be determined
274  * @param regionOfInterest The optional region of interest for which the specific region-of-interest-configuration may be determined, an invalid region otherwise
275  * @param frameTrackingConfiguration The resulting tracking configuration for the entire frame, if defined
276  * @param regionOfInterestTrackingConfiguration The resulting tracking configuration for the specified region of interest, if defined and if a region of interest is defined
277  * @param worker Optional worker object to distribute the computation
278  * @param abort Optional abort statement allowing to stop the execution; True, if the execution has to stop
279  * @return True, if succeeded
280  */
281  static bool determineAutomaticTrackingConfiguration(CV::FrameProviderInterface& frameProviderInterface, const FrameType::PixelOrigin pixelOrigin, const MotionSpeed motionSpeed, const unsigned int frameIndex, const CV::SubRegion& regionOfInterest, TrackingConfiguration* frameTrackingConfiguration, TrackingConfiguration* regionOfInterestTrackingConfiguration, Worker* worker = nullptr, bool* abort = nullptr);
282 
283  /**
284  * Determines the best matching tracking configuration for the point tracker tracking frames within a specified frame range.
285  * @param frameProviderInterface The frame provider interface providing the frame access
286  * @param pixelOrigin The origin of the frame for which the configuration will be determined
287  * @param motionSpeed The expected motion speed of the image content
288  * @param lowerFrameIndex The index of the frame defining the lower frame range, with range [0, infinity)
289  * @param upperFrameIndex The index of the frame defining the upper frame range, with range [lowerFrameIndex, infinity)
290  * @param frameTrackingConfiguration The resulting tracking configuration for the entire frame
291  * @param intermediateFrames The number of intermediate frames which will be distributed within the specified frame range to determine the best matching configuration
292  * @param worker Optional worker object to distribute the computation
293  * @param abort Optional abort statement allowing to stop the execution; True, if the execution has to stop
294  * @return True, if succeeded
295  */
296  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);
297 
298  /**
299  * Determines the number of necessary pyramid layers and coarsest layer radius for a specified frame dimension and motion speed.
300  * @param width The width of the frame (the width of the finest pyramid layer) in pixel, with range [1, infinity)
301  * @param height The height of the frame (the height of the finest pyramid layer) in pixel, with range [1, infinity)
302  * @param motionSpeed The motion speed for which the minimal number of pyramid layers will be determined
303  * @param coarsestLayerRadius Resulting search radius for the coarsest pyramid layer, with range [2, infinity)
304  * @param layers Resulting number of pyramid layers necessary for the defined parameters, with range [3, infinity)
305  * @param maximalCoarsestLayerRadius The maximal (largest) search radius on the coarsest pyramid layers which can be accepted, with range [2, infinity)
306  * @param maximalLayers The maximal number of pyramid layers which can be accepted, with range [1, infinity)
307  */
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));
309 
310  protected:
311 
312  /**
313  * Applies a bidirectional tracking of points between to frames.
314  * @param previousFramePyramid The frame pyramid of the previous frame, must be valid
315  * @param currentFramePyramid The frame pyramid of the current frame, must be valid and must have the same number of layers as 'previousFramePyramid'
316  * @param coarsestLayerRadius The search radius on the coarsest layer, with range [2, infinity)
317  * @param previousFeatureStrengths The strength values for each individual previous image point
318  * @param trackingMethod The tracking method to be used to track the points
319  * @param previousFeaturePoints The image points located in the previous frame
320  * @param currentFeaturePoints The resulting tracked image points located in the current frame
321  * @param validIndices The indices of all image points that could be tracked reliably
322  * @param worker Optional worker object to distribute the computation
323  * @return True, if succeeded
324  */
325  static bool trackPoints(const CV::FramePyramid& previousFramePyramid, const CV::FramePyramid& currentFramePyramid, const unsigned int coarsestLayerRadius, const Strengths& previousFeatureStrengths, const TrackingMethod trackingMethod, Vectors2& previousFeaturePoints, Vectors2& currentFeaturePoints, Indices32& validIndices, Worker* worker);
326 };
327 
328 inline PointPaths::TrackingConfiguration::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) :
329  trackingMethod_(trackingMethod),
330  horizontalBinSize_(0u),
331  verticalBinSize_(0u),
332  strength_(strength),
333  pyramidLayers_(pyramidLayers),
334  coarsestLayerRadius_(coarsestLayerRadius)
335 {
336  const unsigned int maxValue = max(frameWidth, frameHeight);
337 
338  ocean_assert(numberBins != 0u);
339 
340  horizontalBinSize_ = maxValue / numberBins;
341  ocean_assert(horizontalBinSize_ >= 0u && horizontalBinSize_ <= maxValue);
342 
344 
345  ocean_assert((coarsestLayerRadius_ == 0u && pyramidLayers_ == 0u) || (coarsestLayerRadius_ >= 2u && pyramidLayers_ >= 1u));
346 }
347 
348 inline PointPaths::TrackingConfiguration::TrackingConfiguration(const TrackingMethod trackingMethod, const unsigned int horizontalBinSize, const unsigned int verticalBinSize, const unsigned int strength, const unsigned int coarsestLayerRadius, const unsigned int pyramidLayers) :
349  trackingMethod_(trackingMethod),
350  horizontalBinSize_(horizontalBinSize),
351  verticalBinSize_(verticalBinSize),
352  strength_(strength),
353  pyramidLayers_(pyramidLayers),
354  coarsestLayerRadius_(coarsestLayerRadius)
355 {
356  ocean_assert((coarsestLayerRadius_ == 0u && pyramidLayers_ == 0u) || (coarsestLayerRadius_ >= 2u && pyramidLayers_ >= 1u));
357 }
358 
360 {
361  return trackingMethod_;
362 }
363 
365 {
366  return horizontalBinSize_;
367 }
368 
370 {
371  return verticalBinSize_;
372 }
373 
375 {
376  return strength_;
377 }
378 
380 {
381  return coarsestLayerRadius_;
382 }
383 
385 {
386  return pyramidLayers_;
387 }
388 
389 inline unsigned int PointPaths::TrackingConfiguration::horizontalBins(const unsigned int areaWidth, const unsigned int minimalBins) const
390 {
391  ocean_assert(areaWidth >= 1u);
392 
393  if (horizontalBinSize_ == 0u)
394  {
395  return 0u;
396  }
397 
398  return max(minimalBins, (areaWidth + horizontalBinSize_ / 2u) / horizontalBinSize_);
399 }
400 
401 inline unsigned int PointPaths::TrackingConfiguration::verticalBins(const unsigned int areaHeight, const unsigned int minimalBins) const
402 {
403  ocean_assert(areaHeight >= 1u);
404 
405  if (verticalBinSize_ == 0u)
406  {
407  return 0u;
408  }
409 
410  return max(minimalBins, (areaHeight + verticalBinSize_ / 2u) / verticalBinSize_);
411 }
412 
414 {
415  return trackingMethod_ != TM_INVALID && coarsestLayerRadius_ != 0u && pyramidLayers_ != 0u;
416 }
417 
418 }
419 
420 }
421 
422 }
423 
424 #endif // META_OCEAN_TRACKING_OFFLINE_POINT_PATHS_H
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 &regionOfInterest, 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 &currentFramePyramid, const unsigned int coarsestLayerRadius, const Strengths &previousFeatureStrengths, const TrackingMethod trackingMethod, Vectors2 &previousFeaturePoints, Vectors2 &currentFeaturePoints, Indices32 &validIndices, Worker *worker)
Applies a bidirectional tracking of points between to frames.
static bool determineTrackingConfiguration(CV::FrameProviderInterface &frameProviderInterface, const CV::SubRegion &regionOfInterest, 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