Ocean
Loading...
Searching...
No Matches
TestHomographyImageAlignmentDense.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_TESTTACKING_TEST_HOMOGRAPHY_IMAGE_ALIGNMENT_DENSE_H
9#define META_OCEAN_TEST_TESTTACKING_TEST_HOMOGRAPHY_IMAGE_ALIGNMENT_DENSE_H
10
12
13#include "ocean/base/Frame.h"
15
17
18namespace Ocean
19{
20
21namespace Test
22{
23
24namespace TestTracking
25{
26
27/**
28 * This class implements a test for the dense homography image alignment.
29 * @ingroup testtracking
30 */
31class OCEAN_TEST_TRACKING_EXPORT TestHomographyImageAlignmentDense
32{
33 public:
34
35 /**
36 * Invokes all tests.
37 * @param testDuration Number of seconds for each test, with range (0, infinity)
38 * @param worker The worker object
39 * @return True, if succeeded
40 */
41 static bool test(const double testDuration, Worker& worker);
42
43 /**
44 * Tests the additive alignment.
45 * @param testDuration Number of seconds for each test, with range (0, infinity)
46 * @param worker The worker object
47 * @return True, if succeeded
48 */
49 static bool testAdditive(const double testDuration, Worker& worker);
50
51 /**
52 * Tests the additive alignment with specified number of image channels.
53 * @param channels The number of image channels to be used, 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 testAdditive(const unsigned int channels, const double testDuration, Worker& worker);
59
60 /**
61 * Tests the inverse compositional alignment.
62 * @param testDuration Number of seconds for each test, with range (0, infinity)
63 * @param worker The worker object
64 * @return True, if succeeded
65 */
66 static bool testInverseCompositional(const double testDuration, Worker& worker);
67
68 /**
69 * Tests the inverse compositional alignment with specified number of image channels.
70 * @param channels The number of image channels to be used, with range [1, infinity)
71 * @param testDuration Number of seconds for each test, with range (0, infinity)
72 * @param worker The worker object
73 * @return True, if succeeded
74 */
75 static bool testInverseCompositional(const unsigned int channels, const double testDuration, Worker& worker);
76
77 /**
78 * Tests the multi-resolution alignment.
79 * @param testDuration Number of seconds for each test, with range (0, infinity)
80 * @param worker The worker object
81 * @return True, if succeeded
82 */
83 static bool testMultiResolution(const double testDuration, Worker& worker);
84
85 /**
86 * Tests the multi-resolution alignment with specified number of image channels.
87 * @param channels The number of image channels to be used, with range [1, infinity)
88 * @param additive True, to use additive alignment; False, to use inverse compositional alignment
89 * @param testDuration Number of seconds for each test, with range (0, infinity)
90 * @param worker The worker object
91 * @return True, if succeeded
92 */
93 static bool testMultiResolution(const unsigned int channels, const bool additive, const double testDuration, Worker& worker);
94
95 protected:
96
97 /**
98 * Creates a random template image, and random homography and a random tracking image.
99 * @param frameType The frame type to be used for the template frame and the tracking frame, must be valid
100 * @param randomGenerator The random generator to be used
101 * @param templateFrame The resulting template image
102 * @param trackingFrame The resulting tracking image
103 * @param tracking_H_template The resulting homography between template frame and tracking frame
104 * @param maximalHomographyRadius The maximal distance between the ideal image corners and the random homography corners, with range [0, infinity)
105 * @return True, if succeeded
106 */
107 static bool createRandomData(const FrameType& frameType, RandomGenerator& randomGenerator, Frame& templateFrame, Frame& trackingFrame, SquareMatrix3& tracking_H_template, const Scalar maximalHomographyRadius);
108
109 /**
110 * Determines the average pixel intensity differences between the template image, the tracking image, and the adjusted tracking image.
111 * @param templateFrame The template frame to be used
112 * @param trackingFrame The tracking frame to be used
113 * @param estimatedTracking_H_template The estimation transformation between the template frame and the tracking frame
114 * @param averageError The resulting average pixel intensity between the template image and the tracking image (the initial error), with range [0, infinity)
115 * @param averageErrorEstimated The resulting average pixel intensity between the warped template image and the tracking image (based on the estimated homography - the final error), with range [0, infinity)
116 * @return True, if succeeded
117 */
118 static bool determineError(const Frame& templateFrame, const Frame& trackingFrame, const SquareMatrix3& estimatedTracking_H_template, double& averageError, double& averageErrorEstimated);
119};
120
121}
122
123}
124
125}
126
127#endif // META_OCEAN_TEST_TESTTACKING_TEST_HOMOGRAPHY_IMAGE_ALIGNMENT_DENSE_H
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 generator for random numbers.
Definition RandomGenerator.h:42
This class implements a test for the dense homography image alignment.
Definition TestHomographyImageAlignmentDense.h:32
static bool testInverseCompositional(const unsigned int channels, const double testDuration, Worker &worker)
Tests the inverse compositional alignment with specified number of image channels.
static bool createRandomData(const FrameType &frameType, RandomGenerator &randomGenerator, Frame &templateFrame, Frame &trackingFrame, SquareMatrix3 &tracking_H_template, const Scalar maximalHomographyRadius)
Creates a random template image, and random homography and a random tracking image.
static bool testMultiResolution(const unsigned int channels, const bool additive, const double testDuration, Worker &worker)
Tests the multi-resolution alignment with specified number of image channels.
static bool testAdditive(const unsigned int channels, const double testDuration, Worker &worker)
Tests the additive alignment with specified number of image channels.
static bool testMultiResolution(const double testDuration, Worker &worker)
Tests the multi-resolution alignment.
static bool testInverseCompositional(const double testDuration, Worker &worker)
Tests the inverse compositional alignment.
static bool determineError(const Frame &templateFrame, const Frame &trackingFrame, const SquareMatrix3 &estimatedTracking_H_template, double &averageError, double &averageErrorEstimated)
Determines the average pixel intensity differences between the template image, the tracking image,...
static bool testAdditive(const double testDuration, Worker &worker)
Tests the additive alignment.
static bool test(const double testDuration, Worker &worker)
Invokes all tests.
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:129
The namespace covering the entire Ocean framework.
Definition Accessor.h:15