Ocean
|
This class implements Computer Vision utility functions. More...
Data Structures | |
struct | SmallerPatchSize |
This struct is a helper class allowing to determine the next smaller tracking patch for a given patch size. More... | |
struct | SmallerPatchSize< 15u > |
Specialization of the helper struct. More... | |
struct | SmallerPatchSize< 31u > |
Specialization of the helper struct. More... | |
struct | SmallerPatchSize< 5u > |
Specialization of the helper struct. More... | |
struct | SmallerPatchSize< 63u > |
Specialization of the helper struct. More... | |
struct | SmallerPatchSize< 7u > |
Specialization of the helper struct. More... | |
struct | SmallerPatchSize< 9u > |
Specialization of the helper struct. More... | |
Public Member Functions | |
template<> | |
void | randomizeFrame (Frame &frame, const uint8_t minValue, const uint8_t maxValue, const bool skipPaddingArea, RandomGenerator *randomGenerator) |
template<> | |
void | randomizeFrame (Frame &frame, const float minValue, const float maxValue, const bool skipPaddingArea, RandomGenerator *randomGenerator) |
Static Public Member Functions | |
static FrameType::PixelFormats | definedPixelFormats (const FrameType::PixelFormats &genericPixelFormats=FrameType::PixelFormats()) |
Returns all defined pixel formats. More... | |
template<typename T , unsigned int tChannels> | |
static void | copyPixel (T *const target, const T *const source) |
Copies the pixel value from one pixel to another. More... | |
template<unsigned int tChannels> | |
static void | copyPixel (uint8_t *const target, const uint8_t *const source) |
Copies the pixel value from one pixel to another. More... | |
template<typename T , unsigned int tChannels> | |
static void | copyPixel (T *const target, const T *const source, const unsigned int targetIndex, const unsigned int sourceIndex) |
Copies the pixel value from one pixel to another. More... | |
template<unsigned int tChannels> | |
static void | copyPixel (uint8_t *const target, const uint8_t *const source, const unsigned int targetIndex, const unsigned int sourceIndex) |
Copies the pixel value from one pixel to another. More... | |
template<typename T , unsigned int tChannels> | |
static 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) |
Copies the pixel value from one pixel to another. More... | |
template<unsigned int tChannels> | |
static 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) |
Copies the pixel value from one pixel to another. More... | |
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. More... | |
static void | randomizeFrame (Frame &frame, const bool skipPaddingArea=true, RandomGenerator *randomGenerator=nullptr, const bool limitedValueRange=false) |
Creates randomized data for a given frame. More... | |
template<typename T > | |
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. More... | |
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 random (not binary) noise. More... | |
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 random (not binary) noise. More... | |
static bool | isBorderZero (const Frame &frame) |
Returns whether all border pixels of an image are set to zero. More... | |
static int | mirrorOffset (const unsigned int index, const unsigned int elements) |
Deprecated. More... | |
static OCEAN_FORCE_INLINE int | mirrorOffset (const int index, const unsigned int elements) |
Returns the mirrored correction offset for a given index. More... | |
static OCEAN_FORCE_INLINE unsigned int | mirrorIndex (const int index, const unsigned int elements) |
Returns the mirrored index for a given index. More... | |
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. More... | |
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 upper left corner. More... | |
Static Protected Member Functions | |
template<typename T > | |
static bool | isBorderZero (const Frame &frame) |
Returns whether all border pixels of an image are set to zero. More... | |
template<typename T > | |
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. More... | |
This class implements Computer Vision utility functions.
|
inlinestatic |
Copies the pixel value from one pixel to another.
target | The target pixel, must be valid |
source | The source pixel, must be valid |
T | The data type of each pixel channel |
tChannels | Specified the number of pixel channels, with range [1, infinity) |
|
inlinestatic |
Copies the pixel value from one pixel to another.
target | The target image, must be valid |
source | The source image, must be valid |
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] |
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] |
T | The data type of each pixel channel |
tChannels | Specified the number of pixel channels, with range [1, infinity) |
|
inlinestatic |
Copies the pixel value from one pixel to another.
target | The target image, must be valid |
source | The source image, must be valid |
xTarget | Horizontal target position, in pixel, with range [0, targetWidth - 1] |
yTarget | Vertical target position, in pixel, with range [0, targetHeight - 1] |
xSource | Horizontal source position, in pixel, with range [0, sourceWidth - 1] |
ySource | Vertical source position, in pixel, with range [0, sourceHeight - 1] |
targetWidth | Width of the target frame, in pixel, with range [1, infinity) |
sourceWidth | Width of the source frame, in pixel, with range [1, infinity) |
targetPaddingElements | The number of padding elements at the end of each target row, in elements, with range [0, infinity) |
sourcePaddingElements | The number of padding elements at the end of each target row, in elements, with range [0, infinity) |
T | The data type of each pixel channel |
tChannels | Specified the number of pixel channels, with range [1, infinity) |
|
inlinestatic |
Copies the pixel value from one pixel to another.
target | The target pixel, must be valid |
source | The source pixel, must be valid |
tChannels | Specified the number of pixel channels, with range [1, infinity) |
|
inlinestatic |
Copies the pixel value from one pixel to another.
target | The target image, must be valid |
source | The source image, must be valid |
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] |
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] |
tChannels | Specified the number of pixel channels, with range [1, infinity) |
|
inlinestatic |
Copies the pixel value from one pixel to another.
target | The target image, must be valid |
source | The source image, must be valid |
xTarget | Horizontal target position, in pixel, with range [0, targetWidth - 1] |
yTarget | Vertical target position, in pixel, with range [0, targetHeight - 1] |
xSource | Horizontal source position, in pixel, with range [0, sourceWidth - 1] |
ySource | Vertical source position, in pixel, with range [0, sourceHeight - 1] |
targetWidth | Width of the target frame, in pixel, with range [1, infinity) |
sourceWidth | Width of the source frame, in pixel, with range [1, infinity) |
targetPaddingElements | The number of padding elements at the end of each target row, in elements, with range [0, infinity) |
sourcePaddingElements | The number of padding elements at the end of each target row, in elements, with range [0, infinity) |
tChannels | Specified the number of pixel channels, with range [1, infinity) |
|
static |
Creates an image with a checkerboard pattern with pixel format FORMAT_Y8 with a dark elements in the upper left corner.
width | The width of the resulting image, with range [horizontalElements, infinity), must be a multiple of 'horizontalElements' |
height | The height of the resulting image, with range [verticalElements, infinity), must be a multiple of 'verticalElements' |
horizontalElements | The number of horizontal checkerboard elements, with range [1, infinity) |
verticalElements | The number of vertical checkerboard elements, with range [1, infinity) |
paddingElements | The number of padding elements at the end of each image row, in elements, with range [0, infinity) |
bright | The color value of the bright elements |
dark | The color value of the dark elements |
|
static |
Returns all defined pixel formats.
genericPixelFormats | Optional custom generic pixel formats which will be added to the resulting pixel formats |
|
static |
Returns whether all border pixels of an image are set to zero.
frame | The frame to test, must be valid |
|
staticprotected |
Returns whether all border pixels of an image are set to zero.
frame | The frame to test, must be valid |
T | The data type of the pixel elements |
|
static |
Returns whether the padding memory at the end of each image row is identical in two given frames.
In case both frames do not have a padding memory, True is returned.
frameA | The first frame top be compared, must be valid |
frameB | The second frame to be compared, can have a different width as frameA, must be valid |
|
static |
Returns the mirrored index for a given index.
The mirrored index is calculated as follows:
|<----------------------- valid value range -------------------------->| index: -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ... elements - 3, elements - 2, elements - 1, elements + 0, elements + 1 mirrored index: 2 1 0 0 1 2 3 4 5 6 7 elements - 3 elements - 2 elements - 1 elements - 1 elements - 2
index | The index for which the mirrored index will be returned, with range [-elements / 2, elements + elements / 2] |
elements | The number of maximal elements, with range [1, infinity) |
|
static |
Returns the mirrored correction offset for a given index.
The correction offset is calculated as follows:
|<----------------------- valid value range -------------------------->| index: -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, ... elements - 3, elements - 2, elements - 1, elements, elements + 1 result: 5 3 1 0 0 0 0 0 0 0 0 0 0 0 -1 -3
index | The index for which the correction offset will be returned, with range [-elements / 2, elements + elements / 2] |
elements | The number of maximal elements, with range [1, infinity) |
|
inlinestatic |
Deprecated.
Returns the mirrored correction offset for a given index.
index | Index to return the correction offset for |
elements | Number of maximal elements |
|
static |
Creates an 8 bit frame with a random binary mask, the optional padding area will be filled with random (not binary) noise.
The resulting mask may contain random padding elements.
The timestamp will be randomized as well.
width | The width of the resulting frame in pixel, with range [1, infinity) |
height | The height of the resulting frame in pixel, with range [1, infinity) |
maskValue | The value of mask pixels, 0xFF - maskValue will be the value of non-mask pixels, with range [0x00, 0xFF] |
randomGenerator | Random generator object to be used |
|
static |
Returns a randomized frame for a given frame type, the optional padding area will be filled with random (not binary) noise.
The resulting frame may contain random padding elements.
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'
The timestamp will be randomized as well.
frameType | The frame type for which the randomized frame will be created, may be invalid |
randomGenerator | Optional explicit random generator to be used, nullptr to use any |
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 |
|
static |
Creates randomized data for a given frame.
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'
frame | The frame to fill with randomized data, may be invalid |
skipPaddingArea | True, to leave elements within the padding area untouched; False, to randomize the entire memory |
randomGenerator | Optional explicit random generator to be used, nullptr to use any |
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 |
|
inline |
|
static |
Creates randomized data for a given frame while the randomized data will be in a specific value range.
The pixel format of the frame must be generic (a pixel format with zipped channel layout).
frame | The frame to fill with randomized data, may be invalid |
minValue | The minimal random value, with range (-infinity, maxValue] |
maxValue | The maximal random value, with range [minValue, infinity) |
skipPaddingArea | True, to leave elements within the padding area untouched; False, to randomize the entire memory |
randomGenerator | Optional explicit random generator to be used, nullptr to use any |
T | The data type of each pixel element, e.g., 'unsigned char' or 'float' |
|
inline |
|
staticprotected |
Randomizes a given memory block.
data | The memory block to randomize, must be valid |
widthElements | The width of the memory block, in elements, with range [1, infinity) |
height | The height of the memory block, in pixels, with range [1, infinity) |
paddingElements | The number of padding elements at the end of each block row, in elements, with range [0, infinity) |
randomGenerator | The random generator to be used |
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 |
T | The data type of each element |
|
static |
Visualizes the distortion of a camera.
pinholeCamera | The pinhole camera profile for which the distortion/undistortion is visualized |
undistort | True, to visualize the undistorted frame, otherwise the distorted frame is visualized |
horizontalBins | Number of horizontal bins, with range [1, pinholeCamera.width() / 2u) |
verticalBins | Number of vertical bins, with range [1, pinholeCamera.height() / 2u) |
worker | Optional worker object to distribute the computation |