Ocean
TestAlignmentPatternDetector.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 #pragma once
9 
11 
12 namespace Ocean
13 {
14 
15 namespace Test
16 {
17 
18 namespace TestCV
19 {
20 
21 namespace TestDetector
22 {
23 
24 namespace TestQRCodes
25 {
26 
27 /**
28  * This class implements tests for the alignment pattern detector
29  * @ingroup testcvdetectorqrcodes
30  */
31 class OCEAN_TEST_CV_DETECTOR_QRCODES_EXPORT TestAlignmentPatternDetector
32 {
33  public:
34 
35  /**
36  * Tests the functions of the alignment pattern detector.
37  * @param testDuration Number of seconds for each test, with range (0, infinity)
38  * @return True, if succeeded
39  */
40  static bool test(const double testDuration);
41 
42  /**
43  * Test for the detection of alignment patterns using synthetic test data
44  * @param gaussianFilterSize Size of a Gaussian filter that is applied to the synthesized data; no filter is applied for the value 0, range: [0, infinity), must be an odd value
45  * @param testDuration Number of seconds for each test, with range (0, infinity)
46  * @return True, if succeeded
47  */
48  static bool testDetectAlignmentPatternsSyntheticData(const unsigned int gaussianFilterSize, const double testDuration);
49 
50  protected:
51 
52  /**
53  * Draws a single (synthetic) alignment pattern
54  * @param yFrame The 8-bit grayscale image that the alignment pattern will be drawn into, must be valid and the origin in the upper left corner
55  * @param location The location in the input image where the alignment pattern will be draw
56  * @param patternSizeInPixels The side length of the alignment pattern in pixels with which it will be drawn, range: [5, infinity)
57  * @param rotation The angle in radian by which the alignment pattern will be rotated, range: [0, PI/2]
58  * @param foregroundColor The pixel value that will be used for foreground elements, range: [0, 255]
59  * @param backgroundColor The pixel value that will be used for background elements, range: [0, 255]
60  */
61  static void drawAlignmentPattern(Frame& yFrame, const Vector2& location, const Scalar patternSizeInPixels, const Scalar rotation, const uint8_t foregroundColor, const uint8_t backgroundColor);
62 };
63 
64 } // namespace TestQRCodes
65 
66 } // namespace TestDetector
67 
68 } // namespace TestCV
69 
70 } // namespace Test
71 
72 } // namepace Test
This class implements Ocean's image class.
Definition: Frame.h:1760
This class implements tests for the alignment pattern detector.
Definition: TestAlignmentPatternDetector.h:32
static bool test(const double testDuration)
Tests the functions of the alignment pattern detector.
static void drawAlignmentPattern(Frame &yFrame, const Vector2 &location, const Scalar patternSizeInPixels, const Scalar rotation, const uint8_t foregroundColor, const uint8_t backgroundColor)
Draws a single (synthetic) alignment pattern.
static bool testDetectAlignmentPatternsSyntheticData(const unsigned int gaussianFilterSize, const double testDuration)
Test for the detection of alignment patterns using synthetic test data.
float Scalar
Definition of a scalar type.
Definition: Math.h:128
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15