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 * Deprecated.
134 * Use CV::Calibration::Utilities::visualizeDistortion() instead.
135 *
136 * Visualizes the distortion of a camera.
137 * @param pinholeCamera The pinhole camera profile for which the distortion/undistortion is visualized
138 * @param undistort True, to visualize the undistorted frame, otherwise the distorted frame is visualized
139 * @param horizontalBins Number of horizontal bins, with range [1, pinholeCamera.width() / 2u)
140 * @param verticalBins Number of vertical bins, with range [1, pinholeCamera.height() / 2u)
141 * @param worker Optional worker object to distribute the computation
142 * @return Resulting distortion frame
143 */
144 static Frame visualizeDistortion(const PinholeCamera& pinholeCamera, const bool undistort, const unsigned int horizontalBins, const unsigned int verticalBins, Worker* worker = nullptr);
145
146 /**
147 * Creates randomized data for a given frame.
148 * 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'
149 * @param frame The frame to fill with randomized data, may be invalid
150 * @param skipPaddingArea True, to leave elements within the padding area untouched; False, to randomize the entire memory
151 * @param randomGenerator Optional explicit random generator to be used, nullptr to use any
152 * @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
153 */
154 static void randomizeFrame(Frame& frame, const bool skipPaddingArea = true, RandomGenerator* randomGenerator = nullptr, const bool limitedValueRange = false);
155
156 /**
157 * Creates randomized data for a given frame while the randomized data will be in a specific value range.
158 * The pixel format of the frame must be generic (a pixel format with zipped channel layout).
159 * @param frame The frame to fill with randomized data, may be invalid
160 * @param minValue The minimal random value, with range (-infinity, maxValue]
161 * @param maxValue The maximal random value, with range [minValue, infinity)
162 * @param skipPaddingArea True, to leave elements within the padding area untouched; False, to randomize the entire memory
163 * @param randomGenerator Optional explicit random generator to be used, nullptr to use any
164 * @tparam T The data type of each pixel element, e.g., 'unsigned char' or 'float'
165 */
166 template <typename T>
167 static void randomizeFrame(Frame& frame, const T minValue, const T maxValue, const bool skipPaddingArea = true, RandomGenerator* randomGenerator = nullptr);
168
169 /**
170 * Returns a randomized frame for a given frame type, the optional padding area will be filled with random (not binary) noise.
171 * The resulting frame may contain random padding elements.<br>
172 * 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>
173 * The timestamp will be randomized as well.
174 * @param frameType The frame type for which the randomized frame will be created, may be invalid
175 * @param randomGenerator Optional explicit random generator to be used, nullptr to use any
176 * @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
177 * @return The randomized frame, invalid if frameType is invalid
178 */
179 static Frame randomizedFrame(const FrameType& frameType, RandomGenerator* randomGenerator = nullptr, const bool limitedValueRange = false);
180
181 /**
182 * Creates an 8 bit frame with a random binary mask, the optional padding area will be filled with random (not binary) noise.
183 * The resulting mask may contain random padding elements.<br>
184 * The timestamp will be randomized as well.
185 * @param width The width of the resulting frame in pixel, with range [1, infinity)
186 * @param height The height of the resulting frame in pixel, with range [1, infinity)
187 * @param maskValue The value of mask pixels, 0xFF - maskValue will be the value of non-mask pixels, with range [0x00, 0xFF]
188 * @param randomGenerator Random generator object to be used
189 */
190 static Frame randomizedBinaryMask(const unsigned int width, const unsigned int height, const uint8_t maskValue, RandomGenerator* randomGenerator = nullptr);
191
192 /**
193 * Returns whether all border pixels of an image are set to zero.
194 * @param frame The frame to test, must be valid
195 * @return True, if so
196 */
197 static bool isBorderZero(const Frame& frame);
198
199 /**
200 * Deprecated.
201 *
202 * Returns the mirrored correction offset for a given index.
203 * @param index Index to return the correction offset for
204 * @param elements Number of maximal elements
205 * @return The resulting correction offset, with range (-infinity, infinity)
206 */
207 static inline int mirrorOffset(const unsigned int index, const unsigned int elements);
208
209 /**
210 * Returns the mirrored correction offset for a given index.
211 * The correction offset is calculated as follows:
212 * <pre>
213 * |<----------------------- valid value range -------------------------->|
214 *
215 * index: -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ... elements - 3, elements - 2, elements - 1, elements, elements + 1
216 * result: 5 3 1 0 0 0 0 0 0 0 0 0 0 0 -1 -3
217 * </pre>
218 * @param index The index for which the correction offset will be returned, with range [-elements / 2, elements + elements / 2]
219 * @param elements The number of maximal elements, with range [1, infinity)
220 * @return The resulting correction offset, with range (-infinity, infinity)
221 */
222 static OCEAN_FORCE_INLINE int mirrorOffset(const int index, const unsigned int elements);
223
224 /**
225 * Returns the mirrored index for a given index.
226 * The mirrored index is calculated as follows:
227 * <pre>
228 * |<----------------------- valid value range -------------------------->|
229 *
230 * index: -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ... elements - 3, elements - 2, elements - 1, elements + 0, elements + 1
231 * mirrored index: 2 1 0 0 1 2 3 4 5 6 7 elements - 3 elements - 2 elements - 1 elements - 1 elements - 2
232 * </pre>
233 * @param index The index for which the mirrored index will be returned, with range [-elements / 2, elements + elements / 2]
234 * @param elements The number of maximal elements, with range [1, infinity)
235 * @return The resulting mirrored index, with range [0, elements - 1]
236 */
237 static OCEAN_FORCE_INLINE unsigned int mirrorIndex(const int index, const unsigned int elements);
238
239 /**
240 * Returns whether the padding memory at the end of each image row is identical in two given frames.
241 * In case both frames do not have a padding memory, True is returned.
242 * @param frameA The first frame top be compared, must be valid
243 * @param frameB The second frame to be compared, can have a different width as frameA, must be valid
244 * @return True, if so
245 */
246 static bool isPaddingMemoryIdentical(const Frame& frameA, const Frame& frameB);
247
248 /**
249 * Creates an image with a checkerboard pattern with pixel format FORMAT_Y8 with a dark elements in the upper left corner.
250 * @param width The width of the resulting image, with range [horizontalElements, infinity), must be a multiple of 'horizontalElements'
251 * @param height The height of the resulting image, with range [verticalElements, infinity), must be a multiple of 'verticalElements'
252 * @param horizontalElements The number of horizontal checkerboard elements, with range [1, infinity)
253 * @param verticalElements The number of vertical checkerboard elements, with range [1, infinity)
254 * @param paddingElements The number of padding elements at the end of each image row, in elements, with range [0, infinity)
255 * @param bright The color value of the bright elements
256 * @param dark The color value of the dark elements
257 * @return The resulting checkerboard image
258 */
259 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);
260
261 protected:
262
263 /**
264 * Returns whether all border pixels of an image are set to zero.
265 * @param frame The frame to test, must be valid
266 * @return True, if so
267 * @tparam T The data type of the pixel elements
268 */
269 template <typename T>
270 static bool isBorderZero(const Frame& frame);
271
272 /**
273 * Randomizes a given memory block.
274 * @param data The memory block to randomize, must be valid
275 * @param widthElements The width of the memory block, in elements, with range [1, infinity)
276 * @param height The height of the memory block, in pixels, with range [1, infinity)
277 * @param paddingElements The number of padding elements at the end of each block row, in elements, with range [0, infinity)
278 * @param randomGenerator The random generator to be used
279 * @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
280 * @tparam T The data type of each element
281 */
282 template <typename T>
283 static void randomizMemory(T* data, const unsigned int widthElements, const unsigned int height, const unsigned int paddingElements, RandomGenerator& randomGenerator, const bool limitedValueRange);
284};
285
286/**
287 * Specialization of the helper struct.
288 */
289template <>
291{
292 /// The size of the next smaller patch size, which his the same as 5 is the smallest one.
293 const static unsigned int size = 5u;
294};
295
296/**
297 * Specialization of the helper struct.
298 */
299template <>
301{
302 /// The size of the next smaller patch size.
303 const static unsigned int size = 5u;
304};
305
306/**
307 * Specialization of the helper struct.
308 */
309template <>
311{
312 /// The size of the next smaller patch size.
313 const static unsigned int size = 5u;
314};
315
316/**
317 * Specialization of the helper struct.
318 */
319template <>
321{
322 /// The size of the next smaller patch size.
323 const static unsigned int size = 5u;
324};
325
326/**
327 * Specialization of the helper struct.
328 */
329template <>
331{
332 /// The size of the next smaller patch size.
333 const static unsigned int size = 15u;
334};
335
336/**
337 * Specialization of the helper struct.
338 */
339template <>
341{
342 /// The size of the next smaller patch size.
343 const static unsigned int size = 31u;
344};
345
346template <typename T, unsigned int tChannels>
347inline void CVUtilities::copyPixel(T* const target, const T* const source)
348{
349 static_assert(tChannels != 0u, "The specified number of channels is not supported!");
350
351 ocean_assert(target != nullptr && source != nullptr);
352
353 typedef typename DataType<T, tChannels>::Type PixelType;
354
355 *((PixelType*)target) = *((const PixelType*)source);
356}
357
358template <unsigned int tChannels>
359inline void CVUtilities::copyPixel(uint8_t* const target, const uint8_t* const source)
360{
361 copyPixel<uint8_t, tChannels>(target, source);
362}
363
364template <typename T, unsigned int tChannels>
365inline void CVUtilities::copyPixel(T* const target, const T* const source, const unsigned int targetIndex, const unsigned int sourceIndex)
366{
367 static_assert(tChannels != 0u, "The specified number of channels is not supported!");
368
369 ocean_assert(target != nullptr && source != nullptr);
370
371 typedef typename DataType<T, tChannels>::Type PixelType;
372
373 *((PixelType*)target + targetIndex) = *((const PixelType*)source + sourceIndex);
374}
375
376template <unsigned int tChannels>
377inline void CVUtilities::copyPixel(uint8_t* const target, const uint8_t* const source, const unsigned int targetIndex, const unsigned int sourceIndex)
378{
379 copyPixel<uint8_t, tChannels>(target, source, targetIndex, sourceIndex);
380}
381
382template <typename T, unsigned int tChannels>
383inline 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)
384{
385 static_assert(tChannels != 0u, "The specified number of channels is not supported!");
386
387 ocean_assert(target != nullptr && source != nullptr);
388 ocean_assert(xSource < sourceWidth);
389 ocean_assert(xTarget < targetWidth);
390
391 typedef typename DataType<T, tChannels>::Type PixelType;
392
393 const unsigned int sourceStrideElements = sourceWidth * tChannels + sourcePaddingElements;
394 const unsigned int targetStrideElements = targetWidth * tChannels + targetPaddingElements;
395
396 *((PixelType*)(target + yTarget * targetStrideElements) + xTarget) = *((const PixelType*)(source + ySource * sourceStrideElements) + xSource);
397}
398
399template <unsigned int tChannels>
400inline 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)
401{
402 copyPixel<uint8_t, tChannels>(target, source, xTarget, yTarget, xSource, ySource, targetWidth, sourceWidth, targetPaddingElements, sourcePaddingElements);
403}
404
405template <>
406inline void CVUtilities::randomizeFrame(Frame& frame, const uint8_t minValue, const uint8_t maxValue, const bool skipPaddingArea, RandomGenerator* randomGenerator)
407{
408 ocean_assert(frame.isValid());
410 ocean_assert(minValue <= maxValue);
411
412 RandomGenerator localRandomGenerator(randomGenerator);
413
414 const unsigned int elementsInRow = skipPaddingArea ? frame.channels() * frame.width() : frame.strideElements();
415
416 for (unsigned int y = 0u; y < frame.height(); ++y)
417 {
418 uint8_t* data = frame.row<uint8_t>(y);
419
420 for (unsigned int x = 0u; x < elementsInRow; ++x)
421 {
422 data[x] = uint8_t(RandomI::random(localRandomGenerator, (unsigned int)minValue, (unsigned int)maxValue));
423 }
424 }
425}
426
427template <>
428inline void CVUtilities::randomizeFrame(Frame& frame, const float minValue, const float maxValue, const bool skipPaddingArea, RandomGenerator* randomGenerator)
429{
430 ocean_assert(frame.isValid());
432 ocean_assert(minValue <= maxValue);
433
434 RandomGenerator localRandomGenerator(randomGenerator);
435
436 const unsigned int elementsInRow = skipPaddingArea ? frame.channels() * frame.width() : frame.strideElements();
437
438 for (unsigned int y = 0u; y < frame.height(); ++y)
439 {
440 float* data = frame.row<float>(y);
441
442 for (unsigned int x = 0u; x < elementsInRow; ++x)
443 {
444 data[x] = RandomF::scalar(localRandomGenerator, minValue, maxValue);
445 }
446 }
447}
448
449inline int CVUtilities::mirrorOffset(const unsigned int index, const unsigned int elements)
450{
451 return mirrorOffset(int(index), elements);
452}
453
454OCEAN_FORCE_INLINE int CVUtilities::mirrorOffset(const int index, const unsigned int elements)
455{
456 return int(mirrorIndex(index, elements)) - index;
457}
458
459OCEAN_FORCE_INLINE unsigned int CVUtilities::mirrorIndex(const int index, const unsigned int elements)
460{
461 if ((unsigned int)index < elements)
462 {
463 return (unsigned int)(index);
464 }
465
466 if (index < 0)
467 {
468 const unsigned int result = (unsigned int)(-index) - 1u;
469
470 ocean_assert(result < elements);
471
472 return result;
473 }
474 else
475 {
476 const unsigned int result = elements * 2u - (unsigned int)(index) - 1u;
477
478 ocean_assert(result < elements);
479
480 return result;
481 }
482}
483
484}
485
486}
487
488#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)
Deprecated.
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:459
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:449
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:347
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:4141
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:4260
bool isValid() const
Returns whether this frame is valid.
Definition Frame.h:4531
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