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