Ocean
Loading...
Searching...
No Matches
TestFrameInterpolatorBilinear.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_TEST_FRAME_INTERPOLATOR_BILINEAR_H
9#define META_OCEAN_TEST_TESTCV_TEST_FRAME_INTERPOLATOR_BILINEAR_H
10
12
13#include "ocean/base/Frame.h"
14#include "ocean/base/Worker.h"
15
17
18#include "ocean/math/Lookup2.h"
20#include "ocean/math/Vector2.h"
21
23
24namespace Ocean
25{
26
27namespace Test
28{
29
30namespace TestCV
31{
32
33/**
34 * This class implements a bilinear frame interpolation test.
35 * @ingroup testcv
36 */
37class OCEAN_TEST_CV_EXPORT TestFrameInterpolatorBilinear
38{
39 public:
40
41 /**
42 * Tests all bilinear interpolation filter functions.
43 * @param width The width of the source frame in pixel
44 * @param height The height of the source frame in pixel
45 * @param testDuration Number of seconds for each test, with range (0, infinity)
46 * @param worker The worker object to distribute the CPU load
47 * @param selector The test selector to control which tests to run
48 * @return True, if succeeded
49 */
50 static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker, const TestSelector& selector = TestSelector());
51
52 /**
53 * Tests the pixel interpolation function for frames with 8 bit per channel.
54 * @param testDuration Number of seconds for each test, with range (0, infinity)
55 * @return True, if succeeded
56 */
57 static bool testInterpolatePixel8BitPerChannel(const double testDuration);
58
59 /**
60 * Tests the pixel interpolation function for frames with 8 bit per channel.
61 * @param testDuration Number of seconds for each test, with range (0, infinity)
62 * @param pixelCenter The pixel center to be used
63 * @return True, if succeeded
64 * @tparam TScalar The data type of the scalar to be used, either 'float' or 'double'
65 */
66 template <typename TScalar>
67 static bool testInterpolatePixel8BitPerChannel(const CV::PixelCenter pixelCenter, const double testDuration);
68
69 /**
70 * Tests the pixel interpolation function for frames with arbitrary data type.
71 * @param testDuration Number of seconds for each test, with range (0, infinity)
72 * @return True, if succeeded
73 */
74 static bool testInterpolatePixel(const double testDuration);
75
76 /**
77 * Tests the pixel interpolation function for frames arbitrary data type.
78 * @param testDuration Number of seconds for each test, with range (0, infinity)
79 * @param pixelCenter The pixel center to be used
80 * @return True, if succeeded
81 * @tparam TSource The data type of the source to be used
82 * @tparam TTarget The data type of the target to be used
83 * @tparam TScalar The data type of the scalar to be used, either 'float' or 'double'
84 */
85 template <typename TSource, typename TTarget, typename TScalar>
86 static bool testInterpolatePixel(const CV::PixelCenter pixelCenter, const double testDuration);
87
88 /**
89 * Tests the affine transformation function using a constant color for unknown image content.
90 * @param testDuration Number of seconds for each test, with range (0, infinity)
91 * @param worker The worker object to distribute the CPU load
92 * @return True, if succeeded
93 */
94 static bool testAffine(const double testDuration, Worker& worker);
95
96 /**
97 * Tests the homography transformation function supporting arbitrary pixel formats using a constant color for unknown image content.
98 * @param testDuration Number of seconds for each test, with range (0, infinity)
99 * @param worker The worker object to distribute the CPU load
100 * @return True, if succeeded
101 * @tparam T The data type of each pixel channel, e.g., 'float', 'double', 'int', ...
102 */
103 template <typename T>
104 static bool testHomography(const double testDuration, Worker& worker);
105
106 /**
107 * Tests the homography transformation function defining a binary mask for known and unknown image content.
108 * @param testDuration Number of seconds for each test, with range (0, infinity)
109 * @param worker The worker object to distribute the CPU load
110 * @return True, if succeeded
111 */
112 static bool testHomographyMask(const double testDuration, Worker& worker);
113
114 /**
115 * Tests the bilinear resize function for extreme image resolutions.
116 * @param testDuration Number of seconds for each test, with range (0, infinity)
117 * @param worker The worker object to distribute the CPU load
118 * @return True, if succeeded
119 */
120 static bool testResizeExtremeResolutions(const double testDuration, Worker& worker);
121
122 /**
123 * Tests the bilinear resize function.
124 * @param testDuration Number of seconds for each test, with range (0, infinity)
125 * @param worker The worker object to distribute the CPU load
126 * @return True, if succeeded
127 */
128 static bool testResize(const double testDuration, Worker& worker);
129
130 /**
131 * Tests the bilinear resize function supporting arbitrary data types.
132 * @param testDuration Number of seconds for each test, with range (0, infinity)
133 * @param worker The worker object to distribute the CPU load
134 * @return True, if succeeded
135 * @tparam T The data type of each pixel channel, e.g., `uint8_t`, 'float', 'double', ...
136 */
137 template <typename T>
138 static bool testResize(const double testDuration, Worker& worker);
139
140 /**
141 * Tests the frame transformation function applying a lookup table.
142 * @param testDuration Number of seconds for each test, with range (0, infinity)
143 * @param worker The worker object to distribute the CPU load
144 * @return True, if succeeded
145 */
146 static bool testLookup(const double testDuration, Worker& worker);
147
148 /**
149 * Tests the frame transformation function applying a lookup table.
150 * @param testDuration Number of seconds for each test, with range (0, infinity)
151 * @param worker The worker object to distribute the CPU load
152 * @return True, if succeeded
153 * @tparam T The data type of each pixel channel, e.g., `uint8_t`, 'float', 'double', ...
154 */
155 template <typename T>
156 static bool testLookup(const double testDuration, Worker& worker);
157
158 /**
159 * Tests the frame mask transformation function applying a lookup table.
160 * @param width The width of the test frame in pixel, with range [1, infinity)
161 * @param height The height of the test frame in pixel, with range [1, infinity)
162 * @param testDuration Number of seconds for each test, with range (0, infinity)
163 * @param worker The worker object to distribute the CPU load
164 * @return True, if succeeded
165 */
166 static bool testLookupMask(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
167
168 /**
169 * Tests the frame rotate function.
170 * @param width The width of the test frame in pixel, with range [1, infinity)
171 * @param height The height of the test frame in pixel, with range [1, infinity)
172 * @param testDuration Number of seconds for each test, with range (0, infinity)
173 * @param worker The worker object to distribute the CPU load
174 * @return True, if succeeded
175 */
176 static bool testRotateFrame(const unsigned int width, const unsigned int height, const double testDuration, Worker& worker);
177
178 /**
179 * Tests the intensity sum of an image patch with sub-pixel location in a 1-channel frame using an integral image.
180 * @param width The width of the frame in pixel, with range [64, infinity)
181 * @param height The height of the frame in pixel, with range [64, infinity)
182 * @param testDuration Number of seconds for each test, with range (0, infinity)
183 * @return True, if succeeded
184 */
185 static bool testPatchIntensitySum1Channel(const unsigned int width, const unsigned int height, const double testDuration);
186
187 /**
188 * Tests the function for affine transformations (with constant color for unknown image content) for a given frame dimension and channel number.
189 * @param width The width of the frame in pixel, with range [1, infinity)
190 * @param height The height of the frame in pixel, with range [1, infinity)
191 * @param channels The number of frame channels, with range [1, 4]
192 * @param testDuration Number of seconds for each test, with range (0, infinity)
193 * @param worker The worker object to distribute the CPU load
194 * @return True, if succeeded
195 */
196 static bool testAffine(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration, Worker& worker);
197
198 /**
199 * Tests the homography transformation function (with constant color for unknown image content) for arbitrary data types and for a given frame dimension and channel number.
200 * @param width The width of the frame in pixel, with range [1, infinity)
201 * @param height The height of the frame in pixel, with range [1, infinity)
202 * @param channels The number of frame channels, with range [1, 4]
203 * @param testDuration Number of seconds for each test, with range (0, infinity)
204 * @param worker The worker object to distribute the CPU load
205 * @return True, if succeeded
206 * @tparam T The data type of each pixel channel, e.g., 'float', 'double', 'int', ...
207 */
208 template <typename T>
209 static bool testHomography(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration, Worker& worker);
210
211 /**
212 * Tests the homography transformation function (with binary mask defining known and unknown image content) for a given frame dimension and channel number.
213 * @param width The width of the frame in pixel, with range [1, infinity)
214 * @param height The height of the frame in pixel, with range [1, infinity)
215 * @param channels The number of frame channels, with range [1, 4]
216 * @param testDuration Number of seconds for each test, with range (0, infinity)
217 * @param worker The worker object to distribute the CPU load
218 * @return True, if succeeded
219 */
220 static bool testHomographyMask(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration, Worker& worker);
221
222 /**
223 * Tests the bilinear resize function for a given frame dimension and channel number.
224 * @param sourceWidth Width of the source frame in pixel
225 * @param sourceHeight Height of the source frame in pixel
226 * @param sourceChannels Number of the data channels of the source frame, with range [1, 4]
227 * @param targetWidth Width of the target frame in pixel
228 * @param targetHeight Height of the target frame in pixel
229 * @param testDuration Number of seconds for each test, with range (0, infinity)
230 * @param worker The worker object to distribute the CPU load
231 * @return True, if succeeded
232 */
233 static bool testResize(const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int sourceChannels, const unsigned int targetWidth, const unsigned int targetHeight, const double testDuration, Worker& worker);
234
235 /**
236 * Tests the bilinear resize function for arbitrary data types and for a given frame dimension and channel number.
237 * @param sourceWidth Width of the source frame in pixel
238 * @param sourceHeight Height of the source frame in pixel
239 * @param sourceChannels Number of the data channels of the source frame
240 * @param targetWidth Width of the target frame in pixel
241 * @param targetHeight Height of the target frame in pixel
242 * @param testDuration Number of seconds for each test, with range (0, infinity)
243 * @param worker The worker object to distribute the CPU load
244 * @return True, if succeeded
245 * @tparam T The data type of each pixel channel, e.g., 'float', 'double', 'int', ...
246 */
247 template <typename T>
248 static bool testResize(const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int sourceChannels, const unsigned int targetWidth, const unsigned int targetHeight, const double testDuration, Worker& worker);
249
250 /**
251 * Tests the special case resize function for image resolutions from 400x400 to 256x256.
252 * @param testDuration Number of seconds for each test, with range (0, infinity)
253 * @return True, if succeeded
254 */
255 static bool testSpecialCasesResize400x400To256x256_8BitPerChannel(const double testDuration);
256
257 /**
258 * Tests the special case resize function for image resolutions from 400x400 to 224x224.
259 * @param testDuration Number of seconds for each test, with range (0, infinity)
260 * @return True, if succeeded
261 */
262 static bool testSpecialCasesResize400x400To224x224_8BitPerChannel(const double testDuration);
263
264 /**
265 * Tests the frame transformation function applying a lookup table.
266 * @param width The width of the test frame in pixel, with range [20, infinity)
267 * @param height The height of the test frame in pixel, with range [20, infinity)
268 * @param channels The number of frame channels, with range [1, infinity)
269 * @param testDuration Number of seconds for each test, with range (0, infinity)
270 * @param worker The worker object to distribute the CPU load
271 * @return True, if succeeded
272 * @tparam T The data type of each pixel channel, e.g., 'float', 'double', 'int', ...
273 */
274 template <typename T>
275 static bool testLookup(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration, Worker& worker);
276
277 /**
278 * Tests the function to re-sample a camera image.
279 * @param testDuration Number of seconds for each test, with range (0, infinity)
280 * @param worker The worker object to distribute the CPU load
281 * @return True, if succeeded
282 */
283 static bool testResampleCameraImage(const double testDuration, Worker& worker);
284
285 /**
286 * Tests the function to re-sample a camera image.
287 * @param testDuration Number of seconds for each test, with range (0, infinity)
288 * @param worker The worker object to distribute the CPU load
289 * @return True, if succeeded
290 * @tparam T The data type of each pixel channel, e.g., 'float', 'double', 'int', ...
291 */
292 template <typename T>
293 static bool testResampleCameraImage(const double testDuration, Worker& worker);
294
295 /**
296 * Validates the bilinear frame resize function.
297 * @param source The source frame that has been resized, must be valid
298 * @param sourceWidth The width of the source frame in pixel, with range [1, infinity)
299 * @param sourceHeight The height of the source frame in pixel, with range [1, infinity)
300 * @param channels Number of the data channels of the source (and target) frame, with range [1, 4]
301 * @param target The resized target frame to be verified, must be valid
302 * @param targetWidth The width of the target frame in pixel, with range [1, infinity)
303 * @param targetHeight The height of the target frame in pixel, with range [1, infinity)
304 * @param xTargetToSource The horizontal scale factor transforming a location in the target frame to a location in the source frame, with range (0, infinity)
305 * @param yTargetToSource The vertical scale factor transforming a location in the target frame to a location in the source frame, with range (0, infinity)
306 * @param sourcePaddingElements Optional padding at the end of each source row in elements, with range [0, infinity)
307 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
308 * @param averageAbsErrorToInteger Optional resulting average absolute error between the converted result and the ground truth integer result (rounded result), with range [0, 256)
309 * @param maximalAbsErrorToInteger Optional resulting maximal absolute error between the converted result and the ground truth integer result (rounded result), with range [0, 256)
310 * @param groundTruth Optional resulting ground truth data (the resized image content determined with floating point accuracy), nullptr otherwise
311 */
312 static void validateScaleFrame(const unsigned char* source, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const unsigned char* target, const unsigned int targetWidth, const unsigned int targetHeight, const double xTargetToSource, const double yTargetToSource, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, double* averageAbsErrorToInteger, unsigned int* maximalAbsErrorToInteger, unsigned char* groundTruth = nullptr);
313
314 /**
315 * Validates the bilinear frame resize function for arbitrary data types.
316 * @param source The source frame that has been resized, must be valid
317 * @param sourceWidth The width of the source frame in pixel, with range [1, infinity)
318 * @param sourceHeight The height of the source frame in pixel, with range [1, infinity)
319 * @param channels Number of the data channels of the source (and target) frame, with range [1, 4]
320 * @param target The resized target frame to be verified, must be valid
321 * @param targetWidth The width of the target frame in pixel, with range [1, infinity)
322 * @param targetHeight The height of the target frame in pixel, with range [1, infinity)
323 * @param xSource_s_xTarget The horizontal scale factor transforming a location in the target frame to a location in the source frame, with range (0, infinity)
324 * @param ySource_s_yTarget The vertical scale factor transforming a location in the target frame to a location in the source frame, with range (0, infinity)
325 * @param sourcePaddingElements Optional padding at the end of each source row in elements, with range [0, infinity)
326 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
327 * @param averageAbsError Optional resulting average absolute error between the converted result and the ground truth result, with range (-infinity, infinity)
328 * @param maximalAbsError Optional resulting maximal absolute error between the converted result and the ground truth result, with range (-infinity, infinity)
329 * @param groundTruth Optional resulting ground truth data (the resized image content determined with floating point accuracy), nullptr otherwise
330 * @tparam T The data type of each pixel channel, e.g., 'float', 'double', 'int', ...
331 */
332 template <typename T>
333 static void validateScaleFrame(const T* source, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const T* target, const unsigned int targetWidth, const unsigned int targetHeight, const double xSource_s_xTarget, const double ySource_s_yTarget, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, double* averageAbsError, double* maximalAbsError, T* groundTruth = nullptr);
334
335 /**
336 * Validates the homography interpolation function for (almost) arbitrary pixel formats (using a constant background color for unknown image content).
337 * @param input The input frame which has been used for the interpolation, must be valid
338 * @param output The output frame holding the interpolated image information of the input frame, must be valid
339 * @param input_H_output The homography that has been used to interpolate/warp the frame, transforming points int he output frame to points in the input frame, must not be singular
340 * @param backgroundColor The background color for all pixels for which no valid source pixel exists, one for each frame channel, must be valid
341 * @param interpolatedFrameOrigin The origin of the interpolated frame defining the global position of the interpolated frame's pixel coordinate (0, 0), with range (-infinity, infinity)x(-infinity, infinity)
342 * @param averageAbsError Optional resulting average absolute error between the converted result and the ground truth result, with range (-infinity, infinity)
343 * @param maximalAbsError Optional resulting maximal absolute error between the converted result and the ground truth result, with range (-infinity, infinity)
344 * @param groundTruth Optional resulting ground truth frame (the resized image content determined with floating point accuracy), nullptr if not of interest
345 * @tparam T The data type of each pixel channel, e.g., 'float', 'double', 'int', ...
346 */
347 template <typename T>
348 static void validateHomography(const Frame& input, const Frame& output, const SquareMatrix3& input_H_output, const T* backgroundColor, const CV::PixelPositionI& interpolatedFrameOrigin, double* averageAbsError, double* maximalAbsError, Frame* groundTruth = nullptr);
349
350 protected:
351
352 /**
353 * Tests the intensity sum of an image patch with sub-pixel location in a 1-channel frame using an integral image.
354 * @param width The width of the frame, in pixel, with range [patchWidth + 1u, infinity)
355 * @param height The height of the frame, in pixel, with range [patchHeight + 1u, infinity)
356 * @param patchWidth Width of the patch, in pixel, with range [1, infinity)
357 * @param patchHeight Height of the patch, in pixel, with range [1, infinity)
358 * @param testDuration Number of seconds for each test, with range (0, infinity)
359 * @return True, if succeeded
360 */
361 static bool testPatchIntensitySum1Channel(const unsigned int width, const unsigned int height, const unsigned int patchWidth, const unsigned int patchHeight, const double testDuration);
362
363 /**
364 * Validates a pixel interpolation result for frame with 8 bit per channel.
365 * @param frame The frame in pixel the pixel interpolation was applied, must be valid
366 * @param position The position for which the interpolated pixel will be determined, with ranges [0, frame.width() - 1]x[0, frame.height() - 1] for PC_TOP_LEFT, [0, frame.width()]x[0, frame.height()] for PC_CENTER
367 * @param pixelCenter The pixel center to be used during interpolation
368 * @param interpolationResult The interpolation result to be verified, one for each frame channel
369 * @param threshold The maximal distance between interpolated result and ground-truth result so that the result is valid, with range [0, 255)
370 * @return True, if the interpolation is correct
371 * @tparam TScalar The data type of a scalar, either 'float' or 'double'
372 */
373 template <typename TScalar>
374 static bool validateInterpolatePixel8BitPerChannel(const Frame& frame, const VectorT2<TScalar>& position, const CV::PixelCenter pixelCenter, const uint8_t* const interpolationResult, const TScalar threshold);
375
376 /**
377 * Validates a pixel interpolation result for frame with arbitrary data type.
378 * @param frame The frame in pixel the pixel interpolation was applied, must be valid
379 * @param position The position for which the interpolated pixel will be determined, with ranges [0, frame.width() - 1]x[0, frame.height() - 1] for PC_TOP_LEFT, [0, frame.width()]x[0, frame.height()] for PC_CENTER
380 * @param pixelCenter The pixel center to be used during interpolation
381 * @param interpolationResult The interpolation result to be verified, one for each frame channel
382 * @param threshold The maximal distance between interpolated result and ground-truth result so that the result is valid, with range [0, 255)
383 * @return True, if the interpolation is correct
384 * @tparam TSource The data type of the source to be used
385 * @tparam TTarget The data type of the target to be used
386 * @tparam TScalar The data type of a scalar, either 'float' or 'double'
387 */
388 template <typename TSource, typename TTarget, typename TScalar>
389 static bool validateInterpolatePixel(const Frame& frame, const VectorT2<TScalar>& position, const CV::PixelCenter pixelCenter, const TTarget* const interpolationResult, const TScalar threshold);
390
391 /**
392 * Validation function for the bilinear interpolation of 2D homogeneous image transformations (+ constant background color for unknown image content).
393 * @param source The frame which will be interpolated based on the homography, must be valid
394 * @param validationTarget The interpolated frame that will be validated, must the same pixel format and origin as 'source' and must be valid
395 * @param source_H_target The 2D homogeneous image transformation that has been used to interpolate/warp the frame, transforming points defined in the interpolatedFrame to the source frame, i.e. pointFrame = transformation * pointInterpolatedFrame, must not be singular
396 * @param backgroundColor The background color for all pixels for which no valid source pixel exists, one for each frame channel, must be valid
397 * @param interpolatedFrameOrigin The origin of the interpolated frame defining the global position of the interpolated frame's pixel coordinate (0, 0), with range (-infinity, infinity)x(-infinity, infinity)
398 * @return True, if the interpolation is correct
399 */
400 static bool validateTransformation8BitPerChannel(const Frame& source, const Frame& validationTarget, const SquareMatrix3& source_H_target, const uint8_t* backgroundColor, const CV::PixelPositionI& interpolatedFrameOrigin);
401
402 /**
403 * Validates the homography interpolation function (using a binary mask to define known and unknown image content).
404 * @param frame The frame which will be interpolated based on the homography, must be valid
405 * @param interpolatedFrame The interpolated/warped frame to be validated, width same pixel format and pixel origin as 'frame, must be valid
406 * @param interpolatedMask The binary mask corresponding to the interpolated/warped frame specifying known and unknown image content, a mask value of 0xFF defined known image content, 0x00 defines unknown image content, with same pixel origin and frame resolution as 'interpolatedFrame'
407 * @param input_H_output The homography that has been used to interpolate/warp the frame, transforming points in the output frame to points in the input frame, must not be singular
408 * @param interpolatedFrameOrigin The origin of the interpolated frame defining the global position of the interpolated frame's pixel coordinate (0, 0), with range (-infinity, infinity)x(-infinity, infinity)
409 * @return True, if the interpolation is correct
410 */
411 static bool validateHomographyMask8BitPerChannel(const Frame& frame, const Frame& interpolatedFrame, const Frame& interpolatedMask, const SquareMatrix3& input_H_output, const CV::PixelPositionI& interpolatedFrameOrigin);
412
413 /**
414 * Validates the frame transformation function applying a lookup table.
415 * @param sourceFrame The source frame which has been transformed, must be valid
416 * @param targetFrame The target frame which holds the transformed input frame, must be valid
417 * @param lookupTable The lookup table which has been used for the transformation, must be valid
418 * @param offset True, to interpret the lookup values as offset values; False, to interpret the lookup values as absolute locations
419 * @param backgroundColor The background color to be used, must be valid
420 * @return True, if succeeded
421 * @tparam T The data type of each pixel channel, e.g., 'float', 'double', 'int', ...
422 */
423 template <typename T>
424 static bool validateLookup(const Frame& sourceFrame, const Frame& targetFrame, const LookupCorner2<Vector2>& lookupTable, const bool offset, const T* backgroundColor);
425
426 /**
427 * Validates the frame mask transformation function applying a lookup table.
428 * @param sourceFrame The source frame which has been transformed, must be valid
429 * @param targetFrame The target frame which holds the transformed input frame, must be valid
430 * @param targetMask The mask associated with the target frame, must be valid
431 * @param lookupTable The lookup table which has been used for the transformation, must be valid
432 * @param offset True, to interpret the lookup values as offset values; False, to interpret the lookup values as absolute locations
433 * @return True, if succeeded
434 */
435 static bool validateLookupMask(const Frame& sourceFrame, const Frame& targetFrame, const Frame& targetMask, const LookupCorner2<Vector2>& lookupTable, const bool offset);
436
437 /**
438 * Validates the rotation of a frame using a bilinear interpolation.
439 * @param source The source frame to be rotated, must be valid
440 * @param target The target frame which will receive the rotated image, with same frame type as the source frame, must be valid
441 * @param anchorX Position of the rotation anchor in the horizontal direction, with range (-infinity, infinity)
442 * @param anchorY Position of the rotation anchor in the vertical direction, with range (-infinity, infinity)
443 * @param angle The counter clockwise rotation angle in radian, with range [0, 2PI)
444 */
445 static bool validateRotatedFrame(const Frame& source, const Frame& target, const Scalar anchorX, const Scalar anchorY, const Scalar angle);
446
447 /**
448 * Validate the intensity sum of an image patch with sub-pixel location in a 1-channel frame.
449 * @param yFrame The frame in which the intensity sum is determined, with pixel format FORMAT_Y8, must be valid
450 * @param patchWidth The width of the patch, in pixel, with range [1, infinity)
451 * @param patchHeight The height of the patch, in pixel, with range [1, infinity)
452 * @param center The center of the image patch to be used
453 * @param pixelCenter The pixel center to be used
454 * @param intensity The intensity sum to verify
455 * @return True, if succeeded
456 */
457 static bool validatePatchIntensitySum1Channel(const Frame& yFrame, const unsigned int patchWidth, const unsigned int patchHeight, const Vector2& center, const CV::PixelCenter pixelCenter, const Scalar intensity);
458
459 /**
460 * Validate the bilinear extraction of frame patches
461 * @param source Pointer to the data of the source frame, must be valid
462 * @param validationTarget Pointer to the data of the target frame that will validated, must be valid
463 * @param sourceWidth Width of the source frame in pixels, range: [targetWidth, infinity)
464 * @param sourceHeight Height of the source frame in pixels, range: [targetWidth, infinity)
465 * @param x Horizontal center position of the patch, range: [targetWidth/2, sourceWidth - targetWidth/2)
466 * @param y Vertical center position of the patch, range: [targetHeight/2, sourceHeight - targetHeight/2)
467 * @param validationTargetWidth Width of the target frame, range: all odd values in range [1, sourceWidth]
468 * @param validationTargetHeight Height of the target frame, range: all odd values in range [1, sourceHeight]
469 * @param sourcePaddingElements Optional number of padding elements of the source frame
470 * @param validationTargetPaddingElements Optional number of padding elements of the target frame
471 * @return True if the validation was successful, otherwise false.
472 * @tparam tChannels Number of data channels of the given source frame, range: [1, infinity)
473 */
474 template <uint32_t tChannels>
475 static bool validatePatchFrame8BitPerChannel(const uint8_t* const source, const uint8_t* const validationTarget, const uint32_t sourceWidth, const uint32_t sourceHeight, const Scalar x, const Scalar y, const uint32_t validationTargetWidth, const uint32_t validationTargetHeight, const uint32_t sourcePaddingElements, const uint32_t validationTargetPaddingElements);
476
477 /**
478 * Validates the bilinear frame resize function for uint8_t data types using 7-bit integer precision.
479 * This function first interpolates two rows and stores the interpolated result as uint8_t values, followed by an interpolation within the row.
480 * @param source The source frame that has been resized, must be valid
481 * @param sourceWidth The width of the source frame in pixel, with range [1, infinity)
482 * @param sourceHeight The height of the source frame in pixel, with range [1, infinity)
483 * @param channels Number of the data channels of the source (and target) frame, with range [1, 4]
484 * @param target The resized target frame to be verified, must be valid
485 * @param targetWidth The width of the target frame in pixel, with range [1, infinity)
486 * @param targetHeight The height of the target frame in pixel, with range [1, infinity)
487 * @param xSource_s_xTarget The horizontal scale factor transforming a location in the target frame to a location in the source frame, with range (0, infinity)
488 * @param ySource_s_yTarget The vertical scale factor transforming a location in the target frame to a location in the source frame, with range (0, infinity)
489 * @param sourcePaddingElements Optional padding at the end of each source row in elements, with range [0, infinity)
490 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
491 * @param averageAbsError Optional resulting average absolute error between the converted result and the ground truth result, with range (-infinity, infinity)
492 * @param maximalAbsError Optional resulting maximal absolute error between the converted result and the ground truth result, with range (-infinity, infinity)
493 * @param groundTruth Optional resulting ground truth data (the resized image content determined with floating point accuracy), nullptr otherwise
494 */
495 static void validateScaleFramePrecision7Bit(const uint8_t* source, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const uint8_t* target, const unsigned int targetWidth, const unsigned int targetHeight, const double xSource_s_xTarget, const double ySource_s_yTarget, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, double* averageAbsError, double* maximalAbsError, uint8_t* groundTruth = nullptr);
496};
497
498template <typename T>
499void TestFrameInterpolatorBilinear::validateScaleFrame(const T* source, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const T* target, const unsigned int targetWidth, const unsigned int targetHeight, const double xSource_s_xTarget, const double ySource_s_yTarget, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, double* averageAbsError, double* maximalAbsError, T* groundTruth)
500{
501 ocean_assert(source != nullptr && target != nullptr);
502 ocean_assert(sourceWidth != 0u && sourceHeight != 0u);
503 ocean_assert(targetWidth != 0u && targetHeight != 0u);
504 ocean_assert(channels >= 1u);
505 ocean_assert(xSource_s_xTarget > 0.0 && ySource_s_yTarget > 0.0);
506
507 const unsigned int sourceStrideElements = sourceWidth * channels + sourcePaddingElements;
508 const unsigned int targetStrideElements = targetWidth * channels + targetPaddingElements;
509
510 std::vector<T> result(channels, T(0));
511
512 if (averageAbsError)
513 {
514 *averageAbsError = NumericD::maxValue();
515 }
516
517 if (maximalAbsError)
518 {
519 *maximalAbsError = NumericD::maxValue();
520 }
521
522 double sumAbsError = 0.0;
523 double maxAbsError = 0.0;
524
525 for (unsigned int y = 0u; y < targetHeight; ++y)
526 {
527 for (unsigned int x = 0u; x < targetWidth; ++x)
528 {
529 const double sx = minmax(0.0, (double(x) + 0.5) * xSource_s_xTarget - 0.5, double(sourceWidth - 1u));
530 const double sy = minmax(0.0, (double(y) + 0.5) * ySource_s_yTarget - 0.5, double(sourceHeight - 1u));
531
532 const unsigned int leftPixel = (unsigned int)sx;
533 const unsigned int rightPixel = min(leftPixel + 1u, sourceWidth - 1u);
534 ocean_assert(leftPixel < sourceWidth && rightPixel < sourceWidth);
535
536 const unsigned int topPixel = (unsigned int)sy;
537 const unsigned int bottomPixel = min(topPixel + 1u, sourceHeight - 1u);
538 ocean_assert(topPixel < sourceHeight && bottomPixel < sourceHeight);
539
540 const double rightFactor = sx - double(leftPixel);
541 const double bottomFactor = sy - double(topPixel);
542
543 ocean_assert(rightFactor >= 0.0 && rightFactor <= 1.0);
544 ocean_assert(bottomFactor >= 0.0 && bottomFactor <= 1.0);
545
546 const double leftFactor = 1.0 - rightFactor;
547 const double topFactor = 1.0 - bottomFactor;
548
549 const T* sourceTopLeft = source + sourceStrideElements * topPixel + leftPixel * channels;
550 const T* sourceTopRight = source + sourceStrideElements * topPixel + rightPixel * channels;
551
552 const T* sourceBottomLeft = source + sourceStrideElements * bottomPixel + leftPixel * channels;
553 const T* sourceBottomRight = source + sourceStrideElements * bottomPixel + rightPixel * channels;
554
555 for (unsigned int n = 0u; n < channels; ++n)
556 {
557 const double top = double(sourceTopLeft[n]) * leftFactor + double(sourceTopRight[n]) * rightFactor;
558 const double bottom = double(sourceBottomLeft[n]) * leftFactor + double(sourceBottomRight[n]) * rightFactor;
559
560 const double interpolated = top * topFactor + bottom * bottomFactor;
561
562 result[n] = T(interpolated);
563 }
564
565 const T* const targetValue = target + targetStrideElements * y + x * channels;
566
567 for (unsigned int n = 0u; n < channels; ++n)
568 {
569 const double absError = NumericD::abs(double(result[n]) - double(targetValue[n]));
570
571 sumAbsError += absError;
572 maxAbsError = max(maxAbsError, absError);
573 }
574
575 if (groundTruth)
576 {
577 memcpy(groundTruth + (y * targetWidth + x) * channels, result.data(), sizeof(T) * channels);
578 }
579 }
580 }
581
582 if (averageAbsError)
583 {
584 *averageAbsError = sumAbsError / double(targetWidth * targetHeight * channels);
585 }
586
587 if (maximalAbsError)
588 {
589 *maximalAbsError = maxAbsError;
590 }
591}
592
593template <typename T>
594void TestFrameInterpolatorBilinear::validateHomography(const Frame& input, const Frame& output, const SquareMatrix3& input_H_output, const T* backgroundColor, const CV::PixelPositionI& interpolatedFrameOrigin, double* averageAbsError, double* maximalAbsError, Frame* groundTruth)
595{
596 ocean_assert(input.isValid() && output.isValid());
597 ocean_assert(input.isPixelFormatCompatible(output.pixelFormat()));
598
599 ocean_assert(!input_H_output.isSingular());
600 ocean_assert(backgroundColor != nullptr);
601
602 const Scalar frameBorderEps = Scalar(0.5);
603
604 ocean_assert(input.numberPlanes() == 1u);
605
606 const unsigned int channels = input.channels();
607 ocean_assert(channels >= 1u);
608
609 std::vector<T> result(channels, T(0));
610
611 if (averageAbsError != nullptr)
612 {
613 *averageAbsError = NumericD::maxValue();
614 }
615
616 if (maximalAbsError != nullptr)
617 {
618 *maximalAbsError = NumericD::maxValue();
619 }
620
621 if (groundTruth != nullptr)
622 {
623 groundTruth->set(output.frameType(), false /*forceOwner*/, true /*forceWritable*/);
624 }
625
626 double sumAbsError = 0.0;
627 double maxAbsError = 0.0;
628 unsigned long long measurements = 0ull;
629
630 for (unsigned int yOutput = 0u; yOutput < output.height(); ++yOutput)
631 {
632 for (unsigned int xOutput = 0u; xOutput < output.width(); ++xOutput)
633 {
634 const T* const outputPixel = output.constpixel<T>(xOutput, yOutput);
635
636 const Vector2 outputPosition = Vector2(Scalar(xOutput) + Scalar(interpolatedFrameOrigin.x()), Scalar(yOutput) + Scalar(interpolatedFrameOrigin.y()));
637 const Vector2 inputPosition = input_H_output * outputPosition;
638
639 if (inputPosition.x() >= Scalar(0) && inputPosition.y() >= Scalar(0) && inputPosition.x() <= Scalar(input.width() - 1u) && inputPosition.y() <= Scalar(input.height() - 1u))
640 {
641 const unsigned int inputLeftPixel = (unsigned int)(inputPosition.x());
642 const unsigned int inputRightPixel = min(inputLeftPixel + 1u, input.width() - 1u);
643
644 const unsigned int inputTopPixel = (unsigned int)(inputPosition.y());
645 const unsigned int inputBottomPixel = min(inputTopPixel + 1u, input.height() - 1u);
646
647 const double rightFactor = double(inputPosition.x()) - double(inputLeftPixel);
648 const double bottomFactor = double(inputPosition.y()) - double(inputTopPixel);
649
650 ocean_assert(rightFactor >= 0.0 && rightFactor <= 1.0);
651 ocean_assert(bottomFactor >= 0.0 && bottomFactor <= 1.0);
652
653 const double leftFactor = 1.0 - rightFactor;
654 const double topFactor = 1.0 - bottomFactor;
655
656 const T* const inputTopLeft = input.constpixel<T>(inputLeftPixel, inputTopPixel);
657 const T* const inputTopRight = input.constpixel<T>(inputRightPixel, inputTopPixel);
658
659 const T* const inputBottomLeft = input.constpixel<T>(inputLeftPixel, inputBottomPixel);
660 const T* const inputBottomRight = input.constpixel<T>(inputRightPixel, inputBottomPixel);
661
662 for (unsigned int n = 0u; n < channels; ++n)
663 {
664 const double top = double(inputTopLeft[n]) * leftFactor + double(inputTopRight[n]) * rightFactor;
665 const double bottom = double(inputBottomLeft[n]) * leftFactor + double(inputBottomRight[n]) * rightFactor;
666
667 const double interpolated = top * topFactor + bottom * bottomFactor;
668
669 result[n] = T(interpolated);
670 }
671
672 // we do not check the result if we are very close to the frame boundaries
673 if (Numeric::isNotEqual(inputPosition.x(), Scalar(0), frameBorderEps) && Numeric::isNotEqual(inputPosition.x(), Scalar(input.width() - 1u), frameBorderEps)
674 && Numeric::isNotEqual(inputPosition.y(), Scalar(0), frameBorderEps) && Numeric::isNotEqual(inputPosition.y(), Scalar(input.height() - 1u), frameBorderEps))
675 {
676 for (unsigned int n = 0u; n < channels; ++n)
677 {
678 const double absError = NumericD::abs(double(result[n]) - double(outputPixel[n]));
679
680 sumAbsError += absError;
681 maxAbsError = max(maxAbsError, absError);
682
683 measurements++;
684 }
685 }
686
687 if (groundTruth != nullptr)
688 {
689 memcpy(groundTruth->pixel<T>(xOutput, yOutput), result.data(), sizeof(T) * channels);
690 }
691 }
692 else
693 {
694 // we do not check the result if we are very close to the frame boundaries
695 if (Numeric::isNotEqual(inputPosition.x(), Scalar(0), frameBorderEps) && Numeric::isNotEqual(inputPosition.x(), Scalar(input.width() - 1u), frameBorderEps)
696 && Numeric::isNotEqual(inputPosition.y(), Scalar(0), frameBorderEps) && Numeric::isNotEqual(inputPosition.y(), Scalar(input.height() - 1u), frameBorderEps))
697 {
698 for (unsigned int n = 0u; n < channels; ++n)
699 {
700 const double absError = NumericD::abs(double(backgroundColor[n]) - double(outputPixel[n]));
701
702 sumAbsError += absError;
703 maxAbsError = max(maxAbsError, absError);
704
705 measurements++;
706 }
707 }
708
709 if (groundTruth != nullptr)
710 {
711 memcpy(groundTruth->pixel<T>(xOutput, yOutput), backgroundColor, sizeof(T) * channels);
712 }
713 }
714 }
715 }
716
717 ocean_assert(measurements != 0ull || input.width() <= 2u || input.height() <= 2u || output.width() <= 2u || output.height() <= 2u);
718
719 if (averageAbsError && measurements != 0ull)
720 {
721 *averageAbsError = sumAbsError / double(measurements);
722 }
723
724 if (maximalAbsError)
725 {
726 *maximalAbsError = maxAbsError;
727 }
728}
729
730}
731
732}
733
734}
735
736#endif // META_OCEAN_TEST_TESTCV_TEST_FRAME_INTERPOLATOR_BILINEAR_H
This class implements a 2D pixel position with pixel precision.
Definition PixelPosition.h:63
T y() const
Returns the vertical coordinate position of this object.
Definition PixelPosition.h:468
T x() const
Returns the horizontal coordinate position of this object.
Definition PixelPosition.h:456
This class implements Ocean's image class.
Definition Frame.h:1879
const FrameType & frameType() const
Returns the frame type of this frame.
Definition Frame.h:3936
bool isValid() const
Returns whether this frame is valid.
Definition Frame.h:4612
T * pixel(const unsigned int x, const unsigned int y, const unsigned int planeIndex=0u)
Returns the pointer to the data of a specific pixel.
Definition Frame.h:4373
bool set(const FrameType &frameType, const bool forceOwner, const bool forceWritable=false, const Indices32 &planePaddingElements=Indices32(), const Timestamp &timestamp=Timestamp(false), bool *reallocated=nullptr)
Sets a new frame type for this frame.
const T * constpixel(const unsigned int x, const unsigned int y, const unsigned int planeIndex=0u) const
Returns the pointer to the constant data of a specific pixel.
Definition Frame.h:4414
unsigned int width() const
Returns the width of the frame format in pixel.
Definition Frame.h:3241
uint32_t numberPlanes() const
Returns the number of planes of the pixel format of this frame.
Definition Frame.h:3281
PixelFormat pixelFormat() const
Returns the pixel format of the frame.
Definition Frame.h:3251
unsigned int height() const
Returns the height of the frame in pixel.
Definition Frame.h:3246
bool isPixelFormatCompatible(const PixelFormat pixelFormat) const
Returns whether the pixel format of this frame type is compatible with a given pixel format.
Definition Frame.h:3298
unsigned int channels() const
Returns the number of individual channels the frame has.
Definition Frame.h:3271
This class implements a 2D lookup object with values at the bins' corners defining the individual loo...
Definition Lookup2.h:636
static T abs(const T value)
Returns the absolute value of a given value.
Definition Numeric.h:1220
static bool isNotEqual(const T first, const T second)
Returns whether two values are not equal up to a small epsilon.
Definition Numeric.h:2622
static constexpr T maxValue()
Returns the max scalar value.
Definition Numeric.h:3253
bool isSingular() const
Returns whether this matrix is singular (and thus cannot be inverted).
Definition SquareMatrix3.h:1342
This class implements a bilinear frame interpolation test.
Definition TestFrameInterpolatorBilinear.h:38
static bool testResampleCameraImage(const double testDuration, Worker &worker)
Tests the function to re-sample a camera image.
static bool testSpecialCasesResize400x400To256x256_8BitPerChannel(const double testDuration)
Tests the special case resize function for image resolutions from 400x400 to 256x256.
static bool testLookup(const double testDuration, Worker &worker)
Tests the frame transformation function applying a lookup table.
static bool testSpecialCasesResize400x400To224x224_8BitPerChannel(const double testDuration)
Tests the special case resize function for image resolutions from 400x400 to 224x224.
static bool testRotateFrame(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the frame rotate function.
static bool validateRotatedFrame(const Frame &source, const Frame &target, const Scalar anchorX, const Scalar anchorY, const Scalar angle)
Validates the rotation of a frame using a bilinear interpolation.
static bool testResize(const double testDuration, Worker &worker)
Tests the bilinear resize function.
static bool testInterpolatePixel(const double testDuration)
Tests the pixel interpolation function for frames with arbitrary data type.
static bool testLookup(const double testDuration, Worker &worker)
Tests the frame transformation function applying a lookup table.
static bool testPatchIntensitySum1Channel(const unsigned int width, const unsigned int height, const unsigned int patchWidth, const unsigned int patchHeight, const double testDuration)
Tests the intensity sum of an image patch with sub-pixel location in a 1-channel frame using an integ...
static bool testInterpolatePixel8BitPerChannel(const CV::PixelCenter pixelCenter, const double testDuration)
Tests the pixel interpolation function for frames with 8 bit per channel.
static bool testResampleCameraImage(const double testDuration, Worker &worker)
Tests the function to re-sample a camera image.
static bool testPatchIntensitySum1Channel(const unsigned int width, const unsigned int height, const double testDuration)
Tests the intensity sum of an image patch with sub-pixel location in a 1-channel frame using an integ...
static bool validateInterpolatePixel8BitPerChannel(const Frame &frame, const VectorT2< TScalar > &position, const CV::PixelCenter pixelCenter, const uint8_t *const interpolationResult, const TScalar threshold)
Validates a pixel interpolation result for frame with 8 bit per channel.
static bool testHomography(const double testDuration, Worker &worker)
Tests the homography transformation function supporting arbitrary pixel formats using a constant colo...
static bool testResize(const double testDuration, Worker &worker)
Tests the bilinear resize function supporting arbitrary data types.
static bool testAffine(const double testDuration, Worker &worker)
Tests the affine transformation function using a constant color for unknown image content.
static bool testResize(const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int sourceChannels, const unsigned int targetWidth, const unsigned int targetHeight, const double testDuration, Worker &worker)
Tests the bilinear resize function for arbitrary data types and for a given frame dimension and chann...
static bool testAffine(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration, Worker &worker)
Tests the function for affine transformations (with constant color for unknown image content) for a g...
static void validateHomography(const Frame &input, const Frame &output, const SquareMatrix3 &input_H_output, const T *backgroundColor, const CV::PixelPositionI &interpolatedFrameOrigin, double *averageAbsError, double *maximalAbsError, Frame *groundTruth=nullptr)
Validates the homography interpolation function for (almost) arbitrary pixel formats (using a constan...
Definition TestFrameInterpolatorBilinear.h:594
static bool testResizeExtremeResolutions(const double testDuration, Worker &worker)
Tests the bilinear resize function for extreme image resolutions.
static void validateScaleFrame(const unsigned char *source, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const unsigned char *target, const unsigned int targetWidth, const unsigned int targetHeight, const double xTargetToSource, const double yTargetToSource, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, double *averageAbsErrorToInteger, unsigned int *maximalAbsErrorToInteger, unsigned char *groundTruth=nullptr)
Validates the bilinear frame resize function.
static bool testLookup(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration, Worker &worker)
Tests the frame transformation function applying a lookup table.
static bool validatePatchIntensitySum1Channel(const Frame &yFrame, const unsigned int patchWidth, const unsigned int patchHeight, const Vector2 &center, const CV::PixelCenter pixelCenter, const Scalar intensity)
Validate the intensity sum of an image patch with sub-pixel location in a 1-channel frame.
static bool testHomographyMask(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration, Worker &worker)
Tests the homography transformation function (with binary mask defining known and unknown image conte...
static bool validateLookup(const Frame &sourceFrame, const Frame &targetFrame, const LookupCorner2< Vector2 > &lookupTable, const bool offset, const T *backgroundColor)
Validates the frame transformation function applying a lookup table.
static bool testInterpolatePixel8BitPerChannel(const double testDuration)
Tests the pixel interpolation function for frames with 8 bit per channel.
static bool testInterpolatePixel(const CV::PixelCenter pixelCenter, const double testDuration)
Tests the pixel interpolation function for frames arbitrary data type.
static bool testLookupMask(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker)
Tests the frame mask transformation function applying a lookup table.
static bool validateLookupMask(const Frame &sourceFrame, const Frame &targetFrame, const Frame &targetMask, const LookupCorner2< Vector2 > &lookupTable, const bool offset)
Validates the frame mask transformation function applying a lookup table.
static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker, const TestSelector &selector=TestSelector())
Tests all bilinear interpolation filter functions.
static bool testHomographyMask(const double testDuration, Worker &worker)
Tests the homography transformation function defining a binary mask for known and unknown image conte...
static bool testResize(const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int sourceChannels, const unsigned int targetWidth, const unsigned int targetHeight, const double testDuration, Worker &worker)
Tests the bilinear resize function for a given frame dimension and channel number.
static bool testHomography(const unsigned int width, const unsigned int height, const unsigned int channels, const double testDuration, Worker &worker)
Tests the homography transformation function (with constant color for unknown image content) for arbi...
static bool validateHomographyMask8BitPerChannel(const Frame &frame, const Frame &interpolatedFrame, const Frame &interpolatedMask, const SquareMatrix3 &input_H_output, const CV::PixelPositionI &interpolatedFrameOrigin)
Validates the homography interpolation function (using a binary mask to define known and unknown imag...
static bool validateTransformation8BitPerChannel(const Frame &source, const Frame &validationTarget, const SquareMatrix3 &source_H_target, const uint8_t *backgroundColor, const CV::PixelPositionI &interpolatedFrameOrigin)
Validation function for the bilinear interpolation of 2D homogeneous image transformations (+ constan...
static void validateScaleFramePrecision7Bit(const uint8_t *source, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int channels, const uint8_t *target, const unsigned int targetWidth, const unsigned int targetHeight, const double xSource_s_xTarget, const double ySource_s_yTarget, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, double *averageAbsError, double *maximalAbsError, uint8_t *groundTruth=nullptr)
Validates the bilinear frame resize function for uint8_t data types using 7-bit integer precision.
static bool validatePatchFrame8BitPerChannel(const uint8_t *const source, const uint8_t *const validationTarget, const uint32_t sourceWidth, const uint32_t sourceHeight, const Scalar x, const Scalar y, const uint32_t validationTargetWidth, const uint32_t validationTargetHeight, const uint32_t sourcePaddingElements, const uint32_t validationTargetPaddingElements)
Validate the bilinear extraction of frame patches.
static bool validateInterpolatePixel(const Frame &frame, const VectorT2< TScalar > &position, const CV::PixelCenter pixelCenter, const TTarget *const interpolationResult, const TScalar threshold)
Validates a pixel interpolation result for frame with arbitrary data type.
This class implements a test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
This class implements a vector with two elements.
Definition Vector2.h:96
const T & x() const noexcept
Returns the x value.
Definition Vector2.h:710
const T & y() const noexcept
Returns the y value.
Definition Vector2.h:722
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
T minmax(const T &lowerBoundary, const T &value, const T &upperBoundary)
This function fits a given parameter into a specified value range.
Definition base/Utilities.h:973
PixelCenter
Definition of individual centers of pixels.
Definition CV.h:117
float Scalar
Definition of a scalar type.
Definition Math.h:129
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition Vector2.h:28
The namespace covering the entire Ocean framework.
Definition Accessor.h:15