Ocean
Loading...
Searching...
No Matches
TestLineDetectorULF.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_TESTDETECTOR_TEST_LINE_DETECTOR_ULF_H
9#define META_OCEAN_TEST_TESTCV_TESTDETECTOR_TEST_LINE_DETECTOR_ULF_H
10
12
13#include "ocean/base/Frame.h"
14
16
18
19namespace Ocean
20{
21
22namespace Test
23{
24
25namespace TestCV
26{
27
28namespace TestDetector
29{
30
31/**
32 * This class implements line detector tests.
33 * @ingroup testcvdetector
34 */
35class OCEAN_TEST_CV_DETECTOR_EXPORT TestLineDetectorULF : protected CV::Detector::LineDetectorULF
36{
37 public:
38
39 /**
40 * Invokes all test for the line detector.
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 sliding window sum function for single rows calculating the sums of pixel intensities only.
50 * @param testDuration Number of seconds for each test, with range (0, infinity)
51 * @return True, if succeeded
52 */
53 static bool testRowSums(const double testDuration);
54
55 /**
56 * Tests the sliding window sum functions for single rows calculating the sums of pixel intensities and the sums of squared pixel intensities.
57 * @param testDuration Number of seconds for each test, with range (0, infinity)
58 * @return True, if succeeded
59 */
60 static bool testRowSqrSums(const double testDuration);
61
62 /**
63 * Tests the mean square residual bar edge detector.
64 * @param testDuration Number of seconds for each test, with range (0, infinity)
65 * @return True, if succeeded
66 */
67 static bool testRMSBarEdgeDetector(const double testDuration);
68
69 /**
70 * Tests the horizontal RMS Bar edge detector.
71 * @param testDuration Number of seconds for each test, with range (0, infinity)
72 * @return True, if succeeded
73 */
74 static bool testHorizontalRMSBarEdgeDetector(const double testDuration);
75
76 /**
77 * Tests the mean square residual bar line detector.
78 * @param testDuration Number of seconds for each test, with range (0, infinity)
79 * @return True, if succeeded
80 */
81 static bool testRMSBarLineDetector(const double testDuration);
82
83 /**
84 * Tests the mean square residual step edge detector.
85 * @param testDuration Number of seconds for each test, with range (0, infinity)
86 * @return True, if succeeded
87 */
88 static bool testRMSStepEdgeDetector(const double testDuration);
89
90 /**
91 * Tests the horizontal RMS Step edge detector.
92 * @param testDuration Number of seconds for each test, with range (0, infinity)
93 * @return True, if succeeded
94 */
95 static bool testHorizontalRMSStepEdgeDetector(const double testDuration);
96
97 /**
98 * Tests the mean square residual step line detector.
99 * @param testDuration Number of seconds for each test, with range (0, infinity)
100 * @return True, if succeeded
101 */
102 static bool testRMSStepLineDetector(const double testDuration);
103
104 /**
105 * Tests the sum difference edge detector.
106 * @param testDuration Number of seconds for each test, with range (0, infinity)
107 * @return True, if succeeded
108 */
109 static bool testSDStepEdgeDetector(const double testDuration);
110
111 /**
112 * Tests the horizontal SD Step edge detector.
113 * @param testDuration Number of seconds for each test, with range (0, infinity)
114 * @return True, if succeeded
115 */
116 static bool testHorizontalSDStepEdgeDetector(const double testDuration);
117
118 protected:
119
120 /**
121 * Tests the horizontal edge detector of a specific detector.
122 * @param edgeDetector The edge detector to be tested, must support a horizontal detection function
123 * @param testDuration Number of seconds for each test, with range (0, infinity)
124 * @return True, if succeeded
125 */
126 static bool testHorizontalEdgeDetector(const EdgeDetector& edgeDetector, const double testDuration);
127
128 /**
129 * Determines the horizontal RMS-based bar edge response for one pixel with floating point precision.
130 * The response applies non-maximum suppression within a 3-neighborhood.
131 * @param yFrame The 8 bit grayscale frame for which the response will be calculated, must be valid, with dimension [window * 2 + 3, infinity)x[1, infinity)
132 * @param x The horizontal location within the frame, with range [0, width - 1]
133 * @param y The vertical location within the frame, with range [0, height - 1]
134 * @param windowSize The size of the window to be used, in pixel, with range [1, infinity)
135 * @param minimalDelta The minimal intensity delta between average and center pixel, with range [0, 255]
136 * @return The response at the specified location
137 */
138 static double rmsBarEdgeResponse(const Frame& yFrame, const unsigned int x, const unsigned int y, const unsigned int windowSize, const double minimalDelta = 5.0);
139
140 /**
141 * Determines the horizontal RMS-based step edge response for one pixel with floating point precision.
142 * The response applies non-maximum suppression within a 3-neighborhood.
143 * @param yFrame The 8 bit grayscale frame for which the response will be calculated, must be valid, with dimension [window * 2 + 3, infinity)x[1, infinity)
144 * @param x The horizontal location within the frame, with range [0, width - 1]
145 * @param y The vertical location within the frame, with range [0, height - 1]
146 * @param windowSize The size of the window to be used, in pixel, with range [1, infinity)
147 * @param decisionDelta Optional resulting minimal delta between center response and neighbor response
148 * @return The response at the specified location
149 * @tparam tSeparateResidual True, to apply a separate residual for left and right window; False, to apply a common residual
150 * @tparam tSignedSquaredResponse True, to apply the squared (but signed) response values; False, to determine the non-squared responses
151 */
152 template <bool tSeparateResidual, bool tSignedSquaredResponse>
153 static double rmsStepEdgeResponse(const Frame& yFrame, const unsigned int x, const unsigned int y, const unsigned int windowSize, double* decisionDelta = nullptr);
154
155 /**
156 * Determines the horizontal RMS-based step edge response for one pixel with floating point precision.
157 * The response does not apply non-maximum suppression within a 3-neighborhood.
158 * @param yFrame The 8 bit grayscale frame for which the response will be calculated, must be valid, with dimension [window * 2 + 3, infinity)x[1, infinity)
159 * @param x The horizontal location within the frame, with range [0, width - 1]
160 * @param y The vertical location within the frame, with range [0, height - 1]
161 * @param windowSize The size of the window to be used, in pixel, with range [1, infinity)
162 * @return The response at the specified location
163 * @tparam tSeparateResidual True, to apply a separate residual for left and right window; False, to apply a common residual
164 */
165 template <bool tSeparateResidual>
166 static double rmsStepEdgeResponseWithoutNonMaximumSuppression(const Frame& yFrame, const unsigned int x, const unsigned int y, const unsigned int windowSize);
167
168 /**
169 * Determines the horizontal sum difference step edge detector response for a single pixel.
170 * The response applies non-maximum suppression.
171 * @param yFrame The 8 bit grayscale frame for which the response will be calculated, must be valid, with dimension [window * 2 + 3, infinity)x[1, infinity)
172 * @param x The horizontal location within the frame, with range [0, width - 1]
173 * @param y The vertical location within the frame, with range [0, height - 1]
174 * @param stepSize The number of pixels between both windows sums, "should be odd", "should" have range [1, infinity)
175 * @param windowSize The size of the window to be used, in pixel, with range [1, infinity)
176 * @return The response at the specified location
177 */
178 static double sdStepEdgeResponse(const Frame& yFrame, const unsigned int x, const unsigned int y, const unsigned int stepSize, const unsigned int windowSize);
179
180 /**
181 * Determines the horizontal sum difference step edge detector response for a single pixel.
182 * The response does not apply non-maximum suppression.
183 * @param yFrame The 8 bit grayscale frame for which the response will be calculated, must be valid, with dimension [window * 2 + 3, infinity)x[1, infinity)
184 * @param x The horizontal location within the frame, with range [0, width - 1]
185 * @param y The vertical location within the frame, with range [0, height - 1]
186 * @param stepSize The number of pixels between both windows sums, "should be odd", "should" have range [1, infinity)
187 * @param windowSize The size of the window to be used, in pixel, with range [1, infinity)
188 * @return The response at the specified location
189 */
190 static double sdStepEdgeResponseWithoutNonMaximumSuppression(const Frame& yFrame, const unsigned int x, const unsigned int y, const unsigned int stepSize, const unsigned int windowSize);
191};
192
193}
194
195}
196
197}
198
199}
200
201#endif // META_OCEAN_TEST_TESTCV_TESTDETECTOR_TEST_LINE_DETECTOR_ULF_H
This class implements the almost abstract base class for all edge detectors.
Definition LineDetectorULF.h:81
This class implements a line detector optimized for urban lines (Urban Line Finder).
Definition LineDetectorULF.h:34
This class implements Ocean's image class.
Definition Frame.h:1879
This class implements line detector tests.
Definition TestLineDetectorULF.h:36
static bool testRMSBarLineDetector(const double testDuration)
Tests the mean square residual bar line detector.
static bool testRMSStepLineDetector(const double testDuration)
Tests the mean square residual step line detector.
static bool testHorizontalEdgeDetector(const EdgeDetector &edgeDetector, const double testDuration)
Tests the horizontal edge detector of a specific detector.
static bool testRowSqrSums(const double testDuration)
Tests the sliding window sum functions for single rows calculating the sums of pixel intensities and ...
static bool testHorizontalRMSStepEdgeDetector(const double testDuration)
Tests the horizontal RMS Step edge detector.
static double sdStepEdgeResponseWithoutNonMaximumSuppression(const Frame &yFrame, const unsigned int x, const unsigned int y, const unsigned int stepSize, const unsigned int windowSize)
Determines the horizontal sum difference step edge detector response for a single pixel.
static bool testHorizontalRMSBarEdgeDetector(const double testDuration)
Tests the horizontal RMS Bar edge detector.
static double rmsStepEdgeResponseWithoutNonMaximumSuppression(const Frame &yFrame, const unsigned int x, const unsigned int y, const unsigned int windowSize)
Determines the horizontal RMS-based step edge response for one pixel with floating point precision.
static double sdStepEdgeResponse(const Frame &yFrame, const unsigned int x, const unsigned int y, const unsigned int stepSize, const unsigned int windowSize)
Determines the horizontal sum difference step edge detector response for a single pixel.
static bool testRMSBarEdgeDetector(const double testDuration)
Tests the mean square residual bar edge detector.
static double rmsStepEdgeResponse(const Frame &yFrame, const unsigned int x, const unsigned int y, const unsigned int windowSize, double *decisionDelta=nullptr)
Determines the horizontal RMS-based step edge response for one pixel with floating point precision.
static bool testRMSStepEdgeDetector(const double testDuration)
Tests the mean square residual step edge detector.
static bool testHorizontalSDStepEdgeDetector(const double testDuration)
Tests the horizontal SD Step edge detector.
static bool testRowSums(const double testDuration)
Tests the sliding window sum function for single rows calculating the sums of pixel intensities only.
static double rmsBarEdgeResponse(const Frame &yFrame, const unsigned int x, const unsigned int y, const unsigned int windowSize, const double minimalDelta=5.0)
Determines the horizontal RMS-based bar edge response for one pixel with floating point precision.
static bool test(const double testDuration, Worker &worker, const TestSelector &selector)
Invokes all test for the line detector.
static bool testSDStepEdgeDetector(const double testDuration)
Tests the sum difference edge detector.
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