Ocean
Loading...
Searching...
No Matches
TestPanoramaFrame.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_TESTADVANCED_PANORAMA_FRAME_H
9#define META_OCEAN_TEST_TESTCV_TESTADVANCED_PANORAMA_FRAME_H
10
12
14
16
18
19namespace Ocean
20{
21
22namespace Test
23{
24
25namespace TestCV
26{
27
28namespace TestAdvanced
29{
30
31/**
32 * This class implements a test for the panorama frame.
33 * @ingroup testcvadvanced
34 */
35class OCEAN_TEST_CV_ADVANCED_EXPORT TestPanoramaFrame : protected CV::Advanced::PanoramaFrame
36{
37 public:
38
39 /**
40 * Tests the panorama frame functions.
41 * @param testDuration Number of seconds for each test, with range (0, infinity)
42 * @param worker The worker object
43 * @param selector The test selector to filter tests
44 * @return True, if succeeded
45 */
46 static bool test(const double testDuration, Worker& worker, const TestSelector& selector);
47
48 /**
49 * Tests the conversion between frames with different orientations with all possible function parameters.
50 * @param testDuration Number of seconds for each test, with range (0, infinity)
51 * @param worker The worker object
52 * @return True, if succeeded
53 */
54 static bool testCameraFrame2cameraFrame(const double testDuration, Worker& worker);
55
56 /**
57 * Tests the conversion between frames with different orientations with specific function parameters.
58 * @param performanceWidth The image width that should be used to measure run-time performance, range: [1, infinity)
59 * @param performanceHeight The image height that should be used to measure run-time performance, range: [1, infinity)
60 * @param useApproximation True, will run tests on the approximated version of the test function, otherwise it will the pixel-exact one
61 * @param useSourceMask True, it will run tests with masks for the source images, otherwise it will run them without them
62 * @param numberChannels The number of channels that the source images that are used for testing will have, range: [1, 4]
63 * @param testDuration Number of seconds for each test, with range (0, infinity)
64 * @param worker The worker object
65 * @return True, if succeeded
66 */
67 static bool testCameraFrame2cameraFrame(const unsigned int performanceWidth, const unsigned int performanceHeight, const bool useApproximation, const bool useSourceMask, const unsigned int numberChannels, const double testDuration, Worker& worker);
68
69 /**
70 * Tests the cameraFrame2panoramaSubFrame function and the reverse operation.
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 testCameraFrame2panoramaSubFrame(const double testDuration, Worker& worker);
76
77 /**
78 * Tests the re-creation of a panorama frame.
79 * @param worker Optional Worker object
80 * @return True, if succeeded
81 */
82 static bool testRecreation(Worker& worker);
83
84 protected:
85
86 /**
87 * Tests the re-creation of a panorama frame.
88 * @param channels The number of frame channels to be used, with range [1, infinity)
89 * @param approximate True, to apply an approximation using a lookup table
90 * @param worker Optional Worker object
91 * @return True, if succeeded
92 */
93 static bool testRecreation(const unsigned int channels, const bool approximate, Worker& worker);
94
95 /**
96 * Determines the error between two frames.
97 * @param frameA The first frame to be used, must be valid
98 * @param frameB The second frame to be used, with same frame type as frameA, must be valid
99 * @return The average intensity error
100 */
101 static double averageFrameError(const Frame& frameA, const Frame& frameB);
102
103 /**
104 * Validates conversion between frames with different orientations for specific function parameters.
105 * @param sourceCamera The camera profile of the given source frame, must be valid,
106 * @param world_R_source The orientation of the given source frame and camera. Must be orthonormal.
107 * @param source The source frame that will be converted, the frame dimension must match with the given source camera profile, must have a single plane with no more than 4 channels (8 bit), must be valid
108 * @param sourceMask An optional mask defining valid and invalid pixels in the source frame, passing an invalid frame indicates that all pixels in the source frame are valid, otherwise it must be of the same size the source frame and have 1 channel (8 bit) and 1 plane
109 * @param targetCamera The camera profile of the resulting target frame
110 * @param world_R_target The orientation of the resulting target frame, must be orthonormal
111 * @param testTarget The target frame that will be validated, the frame dimension must match with the given source camera profile, must have a single plane with no more than 4 channels, must be valid
112 * @param testTargetMask The target mask of the test target frame that will be validated, defines valid and invalid pixels in the target frame, must be of the same size the target frame and have 1 channel (8 bit) and 1 plane
113 * @param maskValue The mask value defining valid pixels in the mask frames, valid values: {0, 255}
114 * @param approximationBinSize The approximated bin size to be used, with range [1, infinity)
115 * @return True, if succeeded
116 */
117 static bool validateCameraFrame2cameraFrame(const PinholeCamera& sourceCamera, const SquareMatrix3& world_R_source, const Frame& source, const Frame& sourceMask, const PinholeCamera& targetCamera, const SquareMatrix3& world_R_target, const Frame& testTarget, const Frame& testTargetMask, const uint8_t maskValue, const unsigned int approximationBinSize);
118
119};
120
121}
122
123}
124
125}
126
127}
128
129#endif // META_OCEAN_TEST_TESTCV_TESTADVANCED_PANORAMA_FRAME_H
This class implements a panorama frame with spherical projection model.
Definition PanoramaFrame.h:47
This class implements Ocean's image class.
Definition Frame.h:1879
This class implements a test for the panorama frame.
Definition TestPanoramaFrame.h:36
static double averageFrameError(const Frame &frameA, const Frame &frameB)
Determines the error between two frames.
static bool testCameraFrame2cameraFrame(const unsigned int performanceWidth, const unsigned int performanceHeight, const bool useApproximation, const bool useSourceMask, const unsigned int numberChannels, const double testDuration, Worker &worker)
Tests the conversion between frames with different orientations with specific function parameters.
static bool test(const double testDuration, Worker &worker, const TestSelector &selector)
Tests the panorama frame functions.
static bool testCameraFrame2cameraFrame(const double testDuration, Worker &worker)
Tests the conversion between frames with different orientations with all possible function parameters...
static bool testCameraFrame2panoramaSubFrame(const double testDuration, Worker &worker)
Tests the cameraFrame2panoramaSubFrame function and the reverse operation.
static bool validateCameraFrame2cameraFrame(const PinholeCamera &sourceCamera, const SquareMatrix3 &world_R_source, const Frame &source, const Frame &sourceMask, const PinholeCamera &targetCamera, const SquareMatrix3 &world_R_target, const Frame &testTarget, const Frame &testTargetMask, const uint8_t maskValue, const unsigned int approximationBinSize)
Validates conversion between frames with different orientations for specific function parameters.
static bool testRecreation(Worker &worker)
Tests the re-creation of a panorama frame.
static bool testRecreation(const unsigned int channels, const bool approximate, Worker &worker)
Tests the re-creation of a panorama frame.
This class implements a test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
The namespace covering the entire Ocean framework.
Definition Accessor.h:15