Ocean
Loading...
Searching...
No Matches
CVUtilities.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_CV_CV_UTILITIES_H
9#define META_OCEAN_CV_CV_UTILITIES_H
10
11#include "ocean/cv/CV.h"
12
13#include "ocean/base/DataType.h"
14#include "ocean/base/Frame.h"
16#include "ocean/base/RandomI.h"
17#include "ocean/base/Worker.h"
18
20#include "ocean/math/Random.h"
21
22namespace Ocean
23{
24
25namespace CV
26{
27
28/**
29 * This class implements Computer Vision utility functions.
30 * @ingroup cv
31 */
32class OCEAN_CV_EXPORT CVUtilities
33{
34 public:
35
36 /**
37 * This struct is a helper class allowing to determine the next smaller tracking patch for a given patch size.
38 * @tparam tSize The current size of the tracking patch for that the next smaller patch is requested, values might be [5; 7, 9, 15, 31 63]
39 */
40 template <unsigned int tSize>
42 {
43 // nothing to do here this class is empty
44 };
45
46 public:
47
48 /**
49 * Returns all defined pixel formats.
50 * @param genericPixelFormats Optional custom generic pixel formats which will be added to the resulting pixel formats
51 * @return Ocean's defined pixel formats
52 */
54
55 /**
56 * Copies the pixel value from one pixel to another.
57 * @param target The target pixel, must be valid
58 * @param source The source pixel, must be valid
59 * @tparam T The data type of each pixel channel
60 * @tparam tChannels Specified the number of pixel channels, with range [1, infinity)
61 */
62 template <typename T, unsigned int tChannels>
63 static inline void copyPixel(T* const target, const T* const source);
64
65 /**
66 * Copies the pixel value from one pixel to another.
67 * @param target The target pixel, must be valid
68 * @param source The source pixel, must be valid
69 * @tparam tChannels Specified the number of pixel channels, with range [1, infinity)
70 */
71 template <unsigned int tChannels>
72 static inline void copyPixel(uint8_t* const target, const uint8_t* const source);
73
74 /**
75 * Copies the pixel value from one pixel to another.
76 * @param target The target image, must be valid
77 * @param source The source image, must be valid
78 * @param targetIndex Index of the pixel inside the target frame, the index is determined for a pixel (x, y) by (y * width + x), frame channels are handled inside, with range [0, width * height - 1]
79 * @param sourceIndex Index of the pixel inside the source frame, the index is determined for a pixel (x, y) by (y * width + x), frame channels are handled inside, with range [0, width * height - 1]
80 * @tparam T The data type of each pixel channel
81 * @tparam tChannels Specified the number of pixel channels, with range [1, infinity)
82 */
83 template <typename T, unsigned int tChannels>
84 static inline void copyPixel(T* const target, const T* const source, const unsigned int targetIndex, const unsigned int sourceIndex);
85
86 /**
87 * Copies the pixel value from one pixel to another.
88 * @param target The target image, must be valid
89 * @param source The source image, must be valid
90 * @param targetIndex Index of the pixel inside the target frame, the index is determined for a pixel (x, y) by (y * width + x), frame channels are handled inside, with range [0, width * height - 1]
91 * @param sourceIndex Index of the pixel inside the source frame, the index is determined for a pixel (x, y) by (y * width + x), frame channels are handled inside, with range [0, width * height - 1]
92 * @tparam tChannels Specified the number of pixel channels, with range [1, infinity)
93 */
94 template <unsigned int tChannels>
95 static inline void copyPixel(uint8_t* const target, const uint8_t* const source, const unsigned int targetIndex, const unsigned int sourceIndex);
96
97 /**
98 * Copies the pixel value from one pixel to another.
99 * @param target The target image, must be valid
100 * @param source The source image, must be valid
101 * @param xTarget Horizontal target position, in pixel, with range [0, targetWidth - 1]
102 * @param yTarget Vertical target position, in pixel, with range [0, targetHeight - 1]
103 * @param xSource Horizontal source position, in pixel, with range [0, sourceWidth - 1]
104 * @param ySource Vertical source position, in pixel, with range [0, sourceHeight - 1]
105 * @param targetWidth Width of the target frame, in pixel, with range [1, infinity)
106 * @param sourceWidth Width of the source frame, in pixel, with range [1, infinity)
107 * @param targetPaddingElements The number of padding elements at the end of each target row, in elements, with range [0, infinity)
108 * @param sourcePaddingElements The number of padding elements at the end of each target row, in elements, with range [0, infinity)
109 * @tparam T The data type of each pixel channel
110 * @tparam tChannels Specified the number of pixel channels, with range [1, infinity)
111 */
112 template <typename T, unsigned int tChannels>
113 static inline void copyPixel(T* const target, const T* const source, const unsigned int xTarget, const unsigned int yTarget, const unsigned int xSource, const unsigned int ySource, const unsigned int targetWidth, const unsigned int sourceWidth, const unsigned int targetPaddingElements, const unsigned int sourcePaddingElements);
114
115 /**
116 * Copies the pixel value from one pixel to another.
117 * @param target The target image, must be valid
118 * @param source The source image, must be valid
119 * @param xTarget Horizontal target position, in pixel, with range [0, targetWidth - 1]
120 * @param yTarget Vertical target position, in pixel, with range [0, targetHeight - 1]
121 * @param xSource Horizontal source position, in pixel, with range [0, sourceWidth - 1]
122 * @param ySource Vertical source position, in pixel, with range [0, sourceHeight - 1]
123 * @param targetWidth Width of the target frame, in pixel, with range [1, infinity)
124 * @param sourceWidth Width of the source frame, in pixel, with range [1, infinity)
125 * @param targetPaddingElements The number of padding elements at the end of each target row, in elements, with range [0, infinity)
126 * @param sourcePaddingElements The number of padding elements at the end of each target row, in elements, with range [0, infinity)
127 * @tparam tChannels Specified the number of pixel channels, with range [1, infinity)
128 */
129 template <unsigned int tChannels>
130 static inline void copyPixel(uint8_t* const target, const uint8_t* const source, const unsigned int xTarget, const unsigned int yTarget, const unsigned int xSource, const unsigned int ySource, const unsigned int targetWidth, const unsigned int sourceWidth, const unsigned int targetPaddingElements, const unsigned int sourcePaddingElements);
131
132 /**
133 * Visualizes the distortion of a camera.
134 * @param pinholeCamera The pinhole camera profile for which the distortion/undistortion is visualized
135 * @param undistort True, to visualize the undistorted frame, otherwise the distorted frame is visualized
136 * @param horizontalBins Number of horizontal bins, with range [1, pinholeCamera.width() / 2u)
137 * @param verticalBins Number of vertical bins, with range [1, pinholeCamera.height() / 2u)
138 * @param worker Optional worker object to distribute the computation
139 * @return Resulting distortion frame
140 */
141 static Frame visualizeDistortion(const PinholeCamera& pinholeCamera, const bool undistort, const unsigned int horizontalBins, const unsigned int verticalBins, Worker* worker = nullptr);
142
143 /**
144 * Creates randomized data for a given frame.
145 * Integer pixel formats as well as float pixel formats will receive values in the range [0, 255] or [-128, 127] for each pixel and channel if 'limitedValueRange == true'
146 * @param frame The frame to fill with randomized data, may be invalid
147 * @param skipPaddingArea True, to leave elements within the padding area untouched; False, to randomize the entire memory
148 * @param randomGenerator Optional explicit random generator to be used, nullptr to use any
149 * @param limitedValueRange True, to use a value range of [0, 255] and [-128, 127] independently of the actual element data type; False, to use the full value range
150 */
151 static void randomizeFrame(Frame& frame, const bool skipPaddingArea = true, RandomGenerator* randomGenerator = nullptr, const bool limitedValueRange = false);
152
153 /**
154 * Creates randomized data for a given frame while the randomized data will be in a specific value range.
155 * The pixel format of the frame must be generic (a pixel format with zipped channel layout).
156 * @param frame The frame to fill with randomized data, may be invalid
157 * @param minValue The minimal random value, with range (-infinity, maxValue]
158 * @param maxValue The maximal random value, with range [minValue, infinity)
159 * @param skipPaddingArea True, to leave elements within the padding area untouched; False, to randomize the entire memory
160 * @param randomGenerator Optional explicit random generator to be used, nullptr to use any
161 * @tparam T The data type of each pixel element, e.g., 'unsigned char' or 'float'
162 */
163 template <typename T>
164 static void randomizeFrame(Frame& frame, const T minValue, const T maxValue, const bool skipPaddingArea = true, RandomGenerator* randomGenerator = nullptr);
165
166 /**
167 * Returns a randomized frame for a given frame type, the optional padding area will be filled with random (not binary) noise.
168 * The resulting frame may contain random padding elements.<br>
169 * Integer pixel formats as well as float pixel formats will receive values in the range [0, 255] or [-128, 127] for each pixel and channel if 'limitedValueRange == true'<br>
170 * The timestamp will be randomized as well.
171 * @param frameType The frame type for which the randomized frame will be created, may be invalid
172 * @param randomGenerator Optional explicit random generator to be used, nullptr to use any
173 * @param limitedValueRange True, to use a value range of [0, 255] and [-128, 127] independently of the actual element data type; False, to use the full value range
174 * @return The randomized frame, invalid if frameType is invalid
175 */
176 static Frame randomizedFrame(const FrameType& frameType, RandomGenerator* randomGenerator = nullptr, const bool limitedValueRange = false);
177
178 /**
179 * Creates an 8 bit frame with a random binary mask, the optional padding area will be filled with random (not binary) noise.
180 * The resulting mask may contain random padding elements.<br>
181 * The timestamp will be randomized as well.
182 * @param width The width of the resulting frame in pixel, with range [1, infinity)
183 * @param height The height of the resulting frame in pixel, with range [1, infinity)
184 * @param maskValue The value of mask pixels, 0xFF - maskValue will be the value of non-mask pixels, with range [0x00, 0xFF]
185 * @param randomGenerator Random generator object to be used
186 */
187 static Frame randomizedBinaryMask(const unsigned int width, const unsigned int height, const uint8_t maskValue, RandomGenerator* randomGenerator = nullptr);
188
189 /**
190 * Returns whether all border pixels of an image are set to zero.
191 * @param frame The frame to test, must be valid
192 * @return True, if so
193 */
194 static bool isBorderZero(const Frame& frame);
195
196 /**
197 * Deprecated.
198 *
199 * Returns the mirrored correction offset for a given index.
200 * @param index Index to return the correction offset for
201 * @param elements Number of maximal elements
202 * @return The resulting correction offset, with range (-infinity, infinity)
203 */
204 static inline int mirrorOffset(const unsigned int index, const unsigned int elements);
205
206 /**
207 * Returns the mirrored correction offset for a given index.
208 * The correction offset is calculated as follows:
209 * <pre>
210 * |<----------------------- valid value range -------------------------->|
211 *
212 * index: -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ... elements - 3, elements - 2, elements - 1, elements, elements + 1
213 * result: 5 3 1 0 0 0 0 0 0 0 0 0 0 0 -1 -3
214 * </pre>
215 * @param index The index for which the correction offset will be returned, with range [-elements / 2, elements + elements / 2]
216 * @param elements The number of maximal elements, with range [1, infinity)
217 * @return The resulting correction offset, with range (-infinity, infinity)
218 */
219 static OCEAN_FORCE_INLINE int mirrorOffset(const int index, const unsigned int elements);
220
221 /**
222 * Returns the mirrored index for a given index.
223 * The mirrored index is calculated as follows:
224 * <pre>
225 * |<----------------------- valid value range -------------------------->|
226 *
227 * index: -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ... elements - 3, elements - 2, elements - 1, elements + 0, elements + 1
228 * mirrored index: 2 1 0 0 1 2 3 4 5 6 7 elements - 3 elements - 2 elements - 1 elements - 1 elements - 2
229 * </pre>
230 * @param index The index for which the mirrored index will be returned, with range [-elements / 2, elements + elements / 2]
231 * @param elements The number of maximal elements, with range [1, infinity)
232 * @return The resulting mirrored index, with range [0, elements - 1]
233 */
234 static OCEAN_FORCE_INLINE unsigned int mirrorIndex(const int index, const unsigned int elements);
235
236 /**
237 * Returns whether the padding memory at the end of each image row is identical in two given frames.
238 * In case both frames do not have a padding memory, True is returned.
239 * @param frameA The first frame top be compared, must be valid
240 * @param frameB The second frame to be compared, can have a different width as frameA, must be valid
241 * @return True, if so
242 */
243 static bool isPaddingMemoryIdentical(const Frame& frameA, const Frame& frameB);
244
245 /**
246 * Creates an image with a checkerboard pattern with pixel format FORMAT_Y8 with a dark elements in the upper left corner.
247 * @param width The width of the resulting image, with range [horizontalElements, infinity), must be a multiple of 'horizontalElements'
248 * @param height The height of the resulting image, with range [verticalElements, infinity), must be a multiple of 'verticalElements'
249 * @param horizontalElements The number of horizontal checkerboard elements, with range [1, infinity)
250 * @param verticalElements The number of vertical checkerboard elements, with range [1, infinity)
251 * @param paddingElements The number of padding elements at the end of each image row, in elements, with range [0, infinity)
252 * @param bright The color value of the bright elements
253 * @param dark The color value of the dark elements
254 * @return The resulting checkerboard image
255 */
256 static Frame createCheckerboardImage(const unsigned int width, const unsigned int height, const unsigned int horizontalElements, const unsigned int verticalElements, const unsigned int paddingElements, const uint8_t bright = 0xFFu, const uint8_t dark = 0x00u);
257
258 protected:
259
260 /**
261 * Returns whether all border pixels of an image are set to zero.
262 * @param frame The frame to test, must be valid
263 * @return True, if so
264 * @tparam T The data type of the pixel elements
265 */
266 template <typename T>
267 static bool isBorderZero(const Frame& frame);
268
269 /**
270 * Randomizes a given memory block.
271 * @param data The memory block to randomize, must be valid
272 * @param widthElements The width of the memory block, in elements, with range [1, infinity)
273 * @param height The height of the memory block, in pixels, with range [1, infinity)
274 * @param paddingElements The number of padding elements at the end of each block row, in elements, with range [0, infinity)
275 * @param randomGenerator The random generator to be used
276 * @param limitedValueRange True, to use a value range of [0, 255] and [-128, 127] independently of the actual element data type; False, to use the full value range
277 * @tparam T The data type of each element
278 */
279 template <typename T>
280 static void randomizMemory(T* data, const unsigned int widthElements, const unsigned int height, const unsigned int paddingElements, RandomGenerator& randomGenerator, const bool limitedValueRange);
281};
282
283/**
284 * Specialization of the helper struct.
285 */
286template <>
288{
289 /// The size of the next smaller patch size, which his the same as 5 is the smallest one.
290 const static unsigned int size = 5u;
291};
292
293/**
294 * Specialization of the helper struct.
295 */
296template <>
298{
299 /// The size of the next smaller patch size.
300 const static unsigned int size = 5u;
301};
302
303/**
304 * Specialization of the helper struct.
305 */
306template <>
308{
309 /// The size of the next smaller patch size.
310 const static unsigned int size = 5u;
311};
312
313/**
314 * Specialization of the helper struct.
315 */
316template <>
318{
319 /// The size of the next smaller patch size.
320 const static unsigned int size = 5u;
321};
322
323/**
324 * Specialization of the helper struct.
325 */
326template <>
328{
329 /// The size of the next smaller patch size.
330 const static unsigned int size = 15u;
331};
332
333/**
334 * Specialization of the helper struct.
335 */
336template <>
338{
339 /// The size of the next smaller patch size.
340 const static unsigned int size = 31u;
341};
342
343template <typename T, unsigned int tChannels>
344inline void CVUtilities::copyPixel(T* const target, const T* const source)
345{
346 static_assert(tChannels != 0u, "The specified number of channels is not supported!");
347
348 ocean_assert(target != nullptr && source != nullptr);
349
350 typedef typename DataType<T, tChannels>::Type PixelType;
351
352 *((PixelType*)target) = *((const PixelType*)source);
353}
354
355template <unsigned int tChannels>
356inline void CVUtilities::copyPixel(uint8_t* const target, const uint8_t* const source)
357{
358 copyPixel<uint8_t, tChannels>(target, source);
359}
360
361template <typename T, unsigned int tChannels>
362inline void CVUtilities::copyPixel(T* const target, const T* const source, const unsigned int targetIndex, const unsigned int sourceIndex)
363{
364 static_assert(tChannels != 0u, "The specified number of channels is not supported!");
365
366 ocean_assert(target != nullptr && source != nullptr);
367
368 typedef typename DataType<T, tChannels>::Type PixelType;
369
370 *((PixelType*)target + targetIndex) = *((const PixelType*)source + sourceIndex);
371}
372
373template <unsigned int tChannels>
374inline void CVUtilities::copyPixel(uint8_t* const target, const uint8_t* const source, const unsigned int targetIndex, const unsigned int sourceIndex)
375{
376 copyPixel<uint8_t, tChannels>(target, source, targetIndex, sourceIndex);
377}
378
379template <typename T, unsigned int tChannels>
380inline void CVUtilities::copyPixel(T* const target, const T* const source, const unsigned int xTarget, const unsigned int yTarget, const unsigned int xSource, const unsigned int ySource, const unsigned int targetWidth, const unsigned int sourceWidth, const unsigned int targetPaddingElements, const unsigned int sourcePaddingElements)
381{
382 static_assert(tChannels != 0u, "The specified number of channels is not supported!");
383
384 ocean_assert(target != nullptr && source != nullptr);
385 ocean_assert(xSource < sourceWidth);
386 ocean_assert(xTarget < targetWidth);
387
388 typedef typename DataType<T, tChannels>::Type PixelType;
389
390 const unsigned int sourceStrideElements = sourceWidth * tChannels + sourcePaddingElements;
391 const unsigned int targetStrideElements = targetWidth * tChannels + targetPaddingElements;
392
393 *((PixelType*)(target + yTarget * targetStrideElements) + xTarget) = *((const PixelType*)(source + ySource * sourceStrideElements) + xSource);
394}
395
396template <unsigned int tChannels>
397inline void CVUtilities::copyPixel(uint8_t* const target, const uint8_t* const source, const unsigned int xTarget, const unsigned int yTarget, const unsigned int xSource, const unsigned int ySource, const unsigned int targetWidth, const unsigned int sourceWidth, const unsigned int targetPaddingElements, const unsigned int sourcePaddingElements)
398{
399 copyPixel<uint8_t, tChannels>(target, source, xTarget, yTarget, xSource, ySource, targetWidth, sourceWidth, targetPaddingElements, sourcePaddingElements);
400}
401
402template <>
403inline void CVUtilities::randomizeFrame(Frame& frame, const uint8_t minValue, const uint8_t maxValue, const bool skipPaddingArea, RandomGenerator* randomGenerator)
404{
405 ocean_assert(frame.isValid());
407 ocean_assert(minValue <= maxValue);
408
409 RandomGenerator localRandomGenerator(randomGenerator);
410
411 const unsigned int elementsInRow = skipPaddingArea ? frame.channels() * frame.width() : frame.strideElements();
412
413 for (unsigned int y = 0u; y < frame.height(); ++y)
414 {
415 uint8_t* data = frame.row<uint8_t>(y);
416
417 for (unsigned int x = 0u; x < elementsInRow; ++x)
418 {
419 data[x] = uint8_t(RandomI::random(localRandomGenerator, (unsigned int)minValue, (unsigned int)maxValue));
420 }
421 }
422}
423
424template <>
425inline void CVUtilities::randomizeFrame(Frame& frame, const float minValue, const float maxValue, const bool skipPaddingArea, RandomGenerator* randomGenerator)
426{
427 ocean_assert(frame.isValid());
429 ocean_assert(minValue <= maxValue);
430
431 RandomGenerator localRandomGenerator(randomGenerator);
432
433 const unsigned int elementsInRow = skipPaddingArea ? frame.channels() * frame.width() : frame.strideElements();
434
435 for (unsigned int y = 0u; y < frame.height(); ++y)
436 {
437 float* data = frame.row<float>(y);
438
439 for (unsigned int x = 0u; x < elementsInRow; ++x)
440 {
441 data[x] = RandomF::scalar(localRandomGenerator, minValue, maxValue);
442 }
443 }
444}
445
446inline int CVUtilities::mirrorOffset(const unsigned int index, const unsigned int elements)
447{
448 return mirrorOffset(int(index), elements);
449}
450
451OCEAN_FORCE_INLINE int CVUtilities::mirrorOffset(const int index, const unsigned int elements)
452{
453 return int(mirrorIndex(index, elements)) - index;
454}
455
456OCEAN_FORCE_INLINE unsigned int CVUtilities::mirrorIndex(const int index, const unsigned int elements)
457{
458 if ((unsigned int)index < elements)
459 {
460 return (unsigned int)(index);
461 }
462
463 if (index < 0)
464 {
465 const unsigned int result = (unsigned int)(-index) - 1u;
466
467 ocean_assert(result < elements);
468
469 return result;
470 }
471 else
472 {
473 const unsigned int result = elements * 2u - (unsigned int)(index) - 1u;
474
475 ocean_assert(result < elements);
476
477 return result;
478 }
479}
480
481}
482
483}
484
485#endif // META_OCEAN_CV_CV_UTILITIES_H
This class implements Computer Vision utility functions.
Definition CVUtilities.h:33
static Frame randomizedBinaryMask(const unsigned int width, const unsigned int height, const uint8_t maskValue, RandomGenerator *randomGenerator=nullptr)
Creates an 8 bit frame with a random binary mask, the optional padding area will be filled with rando...
static Frame visualizeDistortion(const PinholeCamera &pinholeCamera, const bool undistort, const unsigned int horizontalBins, const unsigned int verticalBins, Worker *worker=nullptr)
Visualizes the distortion of a camera.
static OCEAN_FORCE_INLINE unsigned int mirrorIndex(const int index, const unsigned int elements)
Returns the mirrored index for a given index.
Definition CVUtilities.h:456
static bool isPaddingMemoryIdentical(const Frame &frameA, const Frame &frameB)
Returns whether the padding memory at the end of each image row is identical in two given frames.
static void randomizMemory(T *data, const unsigned int widthElements, const unsigned int height, const unsigned int paddingElements, RandomGenerator &randomGenerator, const bool limitedValueRange)
Randomizes a given memory block.
static FrameType::PixelFormats definedPixelFormats(const FrameType::PixelFormats &genericPixelFormats=FrameType::PixelFormats())
Returns all defined pixel formats.
static int mirrorOffset(const unsigned int index, const unsigned int elements)
Deprecated.
Definition CVUtilities.h:446
static Frame createCheckerboardImage(const unsigned int width, const unsigned int height, const unsigned int horizontalElements, const unsigned int verticalElements, const unsigned int paddingElements, const uint8_t bright=0xFFu, const uint8_t dark=0x00u)
Creates an image with a checkerboard pattern with pixel format FORMAT_Y8 with a dark elements in the ...
static void copyPixel(T *const target, const T *const source)
Copies the pixel value from one pixel to another.
Definition CVUtilities.h:344
static bool isBorderZero(const Frame &frame)
Returns whether all border pixels of an image are set to zero.
static Frame randomizedFrame(const FrameType &frameType, RandomGenerator *randomGenerator=nullptr, const bool limitedValueRange=false)
Returns a randomized frame for a given frame type, the optional padding area will be filled with rand...
static bool isBorderZero(const Frame &frame)
Returns whether all border pixels of an image are set to zero.
static void randomizeFrame(Frame &frame, const bool skipPaddingArea=true, RandomGenerator *randomGenerator=nullptr, const bool limitedValueRange=false)
Creates randomized data for a given frame.
static void randomizeFrame(Frame &frame, const T minValue, const T maxValue, const bool skipPaddingArea=true, RandomGenerator *randomGenerator=nullptr)
Creates randomized data for a given frame while the randomized data will be in a specific value range...
This class implements Ocean's image class.
Definition Frame.h:1808
unsigned int strideElements(const unsigned int planeIndex=0u) const
Returns the number of elements within one row, including optional padding at the end of a row for a s...
Definition Frame.h:4138
T * row(const unsigned int y, const unsigned int planeIndex=0u)
Returns the pointer to the pixel data of a specific row.
Definition Frame.h:4257
bool isValid() const
Returns whether this frame is valid.
Definition Frame.h:4528
Definition of a frame type composed by the frame dimension, pixel format and pixel origin.
Definition Frame.h:30
unsigned int width() const
Returns the width of the frame format in pixel.
Definition Frame.h:3170
std::vector< PixelFormat > PixelFormats
Definition of a vector holding pixel formats.
Definition Frame.h:1040
PixelFormat pixelFormat() const
Returns the pixel format of the frame.
Definition Frame.h:3180
@ DT_UNSIGNED_INTEGER_8
Unsigned 8 bit integer data type (uint8_t).
Definition Frame.h:41
@ DT_SIGNED_FLOAT_32
Signed 32 bit float data type (float).
Definition Frame.h:59
unsigned int height() const
Returns the height of the frame in pixel.
Definition Frame.h:3175
unsigned int channels() const
Returns the number of individual channels the frame has.
Definition Frame.h:3200
DataType dataType() const
Returns the data type of the pixel format of this frame.
Definition Frame.h:3190
static bool formatIsGeneric(const PixelFormat pixelFormat, const DataType dataType, const uint32_t channels, const uint32_t planes=1u, const uint32_t widthMultiple=1u, const uint32_t heightMultiple=1u)
Checks whether a given pixel format is a specific layout regarding data channels and data type.
Definition Frame.h:3435
This class implements a generator for random numbers.
Definition RandomGenerator.h:42
static unsigned int random(const unsigned int maxValue)
Returns one random integer value with specified maximum value.
static T scalar(const T lower, const T upper)
Returns a random number between two borders.
Definition Random.h:388
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
This struct is a helper class allowing to determine the next smaller tracking patch for a given patch...
Definition CVUtilities.h:42
Default definition of a type with tBytes bytes.
Definition DataType.h:32