Ocean
TestFinderPatternDetector.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 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Test
20 {
21 
22 namespace TestCV
23 {
24 
25 namespace TestDetector
26 {
27 
28 namespace TestQRCodes
29 {
30 
31 /**
32  * This class implements a test for the QR code detector.
33  * @ingroup testcvdetectorqrcodes
34  */
35 class OCEAN_TEST_CV_DETECTOR_QRCODES_EXPORT TestFinderPatternDetector : protected CV::Detector::QRCodes::FinderPatternDetector
36 {
37  public:
38 
39  /**
40  * Invokes all test for the QR code detector.
41  * @param testDuration Number of seconds for each test, with range (0, infinity)
42  * @param worker The worker object
43  * @return True, if succeeded
44  */
45  static bool test(const double testDuration, Worker& worker);
46 
47  /**
48  * Tests the detection of finder patterns in row (horizontal detection)
49  * @param filterSize the size of the Gaussian blur kernel to be applied, range: [1, infinity) must be odd, use 0 to disable blurring altogether
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 testDetectFinderPatternSyntheticData(const unsigned int filterSize, const double testDuration, Worker& worker);
55 
56  protected:
57 
58  /**
59  * Paint a finder pattern into a grayscale image.
60  * @param yFrame The grayscale image, with pixel format FORMAT_Y8, with resolution [29, infinity)x[29, infinity), must be valid
61  * @param location The location of the center of the finder pattern that will be drawn. Must inside the image and at least `round(length)` pixels away from frame border
62  * @param length Diameter of the finder pattern in horizontal direction, range: [7, infinity)
63  * @param rotation The rotation angle in radian, range: (-infinity, infinity)
64  * @param foregroundColor Color that is used for the finder pattern (usually black), range: [0, 255]
65  * @param backgroundColor Background color that the finder pattern is drawn on (usually white), range: [0, 255]
66  * @param worker Optional worker instance
67  */
68  static void paintFinderPattern(Frame& yFrame, const Vector2& location, const Scalar& length, const Scalar& rotation, const uint8_t foregroundColor, const uint8_t backgroundColor, Worker* worker = nullptr);
69 };
70 
71 } // namespace TestQRCodes
72 
73 } // namespace TestDetector
74 
75 } // namespace TestCV
76 
77 } // namespace Test
78 
79 } // namespace Ocean
This class implements a detector for finder patterns which are part of QR Codes.
Definition: FinderPatternDetector.h:205
This class implements Ocean's image class.
Definition: Frame.h:1760
This class implements a test for the QR code detector.
Definition: TestFinderPatternDetector.h:36
static bool test(const double testDuration, Worker &worker)
Invokes all test for the QR code detector.
static bool testDetectFinderPatternSyntheticData(const unsigned int filterSize, const double testDuration, Worker &worker)
Tests the detection of finder patterns in row (horizontal detection)
static void paintFinderPattern(Frame &yFrame, const Vector2 &location, const Scalar &length, const Scalar &rotation, const uint8_t foregroundColor, const uint8_t backgroundColor, Worker *worker=nullptr)
Paint a finder pattern into a grayscale image.
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
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15