Ocean
testdetector/TestPointTracking.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_TEST_TESTCV_TESTDETECTOR_TEST_POINT_TRACKING_H
9 #define META_OCEAN_TEST_TESTCV_TESTDETECTOR_TEST_POINT_TRACKING_H
10 
12 
13 #include "ocean/base/Frame.h"
14 #include "ocean/base/Worker.h"
15 
17 #include "ocean/math/Vector2.h"
18 
19 namespace Ocean
20 {
21 
22 namespace Test
23 {
24 
25 namespace TestCV
26 {
27 
28 namespace TestDetector
29 {
30 
31 /**
32  * This class implements a point tracking test.
33  * @ingroup testcvdetector
34  */
35 class OCEAN_TEST_CV_DETECTOR_EXPORT TestPointTracking
36 {
37  public:
38 
39  /**
40  * Tests entire point tracking functionality.
41  * @param frame Test frame to be used for point detection and tracking, with frame dimension [80, infinity)x[80, infinity), must be valid
42  * @param testDuration Number of seconds for each test, with range (0, infinity)
43  * @param worker The worker object
44  * @return True, if succeeded
45  */
46  static bool test(const Frame& frame, const double testDuration, Worker& worker);
47 
48  private:
49 
50  /**
51  * Test point tracking based on Harris corner detection and point motion.
52  * @param frame Original frame to be used for feature detection
53  * @param channels The number of frame channels to be used for testing, with range [1, infinity)
54  * @param testDuration Number of seconds for each test, with range (0, infinity)
55  * @param worker The worker object
56  * @return True, if succeeded
57  */
58  static bool testMotion(const Frame& frame, const unsigned int channels, const double testDuration, Worker & worker);
59 
60  /**
61  * Determines the accuracy of point correspondences based on the ground truth transformation.
62  * @param points0 The first set of image points, at least one
63  * @param points1 The second set of image points, one for each image point in the first set
64  * @param frame0_H_frame1 The transformation transforming points from the second frame to points int he first frame, must be valid
65  * @param maxDistance Maximal distance between the determined point and the correct ground truth point so that a correspondence counts as valid, in pixel, with range [0, infinity)
66  * @return The percentage of valid correspondences, with range [0, 1]
67  */
68  static double validateAccuracy(const Vectors2& points0, const Vectors2& points1, const SquareMatrix3& frame0_H_frame1, const Scalar maxDistance = Scalar(2));
69 };
70 
71 }
72 
73 }
74 
75 }
76 
77 }
78 
79 #endif // META_OCEAN_TEST_TESTCV_TESTDETECTOR_TEST_POINT_TRACKING_H
This class implements Ocean's image class.
Definition: Frame.h:1760
This class implements a point tracking test.
Definition: testdetector/TestPointTracking.h:36
static double validateAccuracy(const Vectors2 &points0, const Vectors2 &points1, const SquareMatrix3 &frame0_H_frame1, const Scalar maxDistance=Scalar(2))
Determines the accuracy of point correspondences based on the ground truth transformation.
static bool test(const Frame &frame, const double testDuration, Worker &worker)
Tests entire point tracking functionality.
static bool testMotion(const Frame &frame, const unsigned int channels, const double testDuration, Worker &worker)
Test point tracking based on Harris corner detection and point motion.
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
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