This class implements basic maks analyzing functions.
More...
|
static PixelBoundingBox | detectBoundingBox (const uint8_t *mask, const unsigned int width, const unsigned int height, const uint8_t nonMaskPixel, const unsigned int maskPaddingElements) |
| Detects the smallest axis-aligned bounding box enclosing all isolated mask islands in a binary (but 8-bit) mask frame. More...
|
|
static PixelBoundingBox | detectBoundingBox (const uint8_t *const mask, const unsigned int width, const unsigned int height, const PixelBoundingBox &rough, const unsigned int maxUncertainty, const uint8_t nonMaskPixel=0xFFu, const unsigned int maskPaddingElements=0u) |
| Detects the smallest axis-aligned bounding box enclosing all isolated mask islands inside a given mask frame using a rough approximation of the bounding box. More...
|
|
template<typename T > |
static PixelBoundingBox | detectOpaqueBoundingBox (const T *frame, const unsigned int width, const unsigned int height, const unsigned int alphaChannelIndex, const unsigned int channels, const T fullTransparentValue, const unsigned int framePaddingElements, Worker *worker=nullptr) |
| Detects the smallest bounding box enclosing all opaque pixels in a given frame. More...
|
|
static PixelBoundingBox | detectOpaqueBoundingBox (const Frame &frame, const bool transparentIs0xFF, Worker *worker=nullptr) |
| Detects the smallest bounding box of opaque pixels in a given frame. More...
|
|
static bool | hasValue (const uint8_t *mask, const unsigned int width, const unsigned int height, const uint8_t value, const unsigned int maskPaddingElements, const PixelBoundingBox &boundingBox=CV::PixelBoundingBox()) |
| Returns whether a mask frame has at least one pixel with a specific mask value. More...
|
|
|
template<typename T > |
static void | detectOpaqueBoundingBoxSubset (const T *frame, const unsigned int width, const unsigned int height, const unsigned int alphaChannelIndex, const unsigned int channels, const T fullTransparentValue, const unsigned int framePaddingElements, unsigned int *left, unsigned int *top, unsigned int *right, unsigned int *bottom, Lock *lock, const unsigned int firstRow, const unsigned int numberRows) |
| Detects the smallest bounding box enclosing all opaque pixels in a subset of a given frame. More...
|
|
This class implements basic maks analyzing functions.
More advanced mask analyzing functions are available in CV::Segmentation::MaskAnalyzer.
◆ detectBoundingBox() [1/2]
static PixelBoundingBox Ocean::CV::MaskAnalyzer::detectBoundingBox |
( |
const uint8_t *const |
mask, |
|
|
const unsigned int |
width, |
|
|
const unsigned int |
height, |
|
|
const PixelBoundingBox & |
rough, |
|
|
const unsigned int |
maxUncertainty, |
|
|
const uint8_t |
nonMaskPixel = 0xFFu , |
|
|
const unsigned int |
maskPaddingElements = 0u |
|
) |
| |
|
static |
Detects the smallest axis-aligned bounding box enclosing all isolated mask islands inside a given mask frame using a rough approximation of the bounding box.
- Parameters
-
mask | The 8 bit mask frame in which the bounding box will be determined, must be valid |
width | The width of the mask frame in pixel, with range [1, infinity) |
height | The height of the mask frame in pixel, with range [1, infinity) |
rough | Rough approximation of the final bounding box, must be valid |
maxUncertainty | Maximal pixel uncertainty of the rough box guess, with range [1, infinity) |
nonMaskPixel | The value of pixel not part of the mask, all other values will be mask pixels, with range [0, infinity) |
maskPaddingElements | The number of padding elements at the end of each mask row, with range [0, infinity) |
- Returns
- Resulting mask bounding box, invalid if no mask could be found
◆ detectBoundingBox() [2/2]
static PixelBoundingBox Ocean::CV::MaskAnalyzer::detectBoundingBox |
( |
const uint8_t * |
mask, |
|
|
const unsigned int |
width, |
|
|
const unsigned int |
height, |
|
|
const uint8_t |
nonMaskPixel, |
|
|
const unsigned int |
maskPaddingElements |
|
) |
| |
|
static |
Detects the smallest axis-aligned bounding box enclosing all isolated mask islands in a binary (but 8-bit) mask frame.
- Parameters
-
mask | The 8 bit mask frame in which the enclosing bounding box will be determined, must be valid |
width | The width of the mask frame in pixel, with range [1, infinity) |
height | The height of the mask frame in pixel, with range [1, infinity) |
nonMaskPixel | The value of pixels not part of the mask, all other values will be mask pixels, with range [0, infinity) |
maskPaddingElements | The number of padding elements at the end of each mask row, with range [0, infinity) |
- Returns
- Resulting mask bounding box, invalid if no mask could be found
- See also
- CV::Segmentation::MaskAnalyzer::detectBoundingBoxes().
◆ detectOpaqueBoundingBox() [1/2]
static PixelBoundingBox Ocean::CV::MaskAnalyzer::detectOpaqueBoundingBox |
( |
const Frame & |
frame, |
|
|
const bool |
transparentIs0xFF, |
|
|
Worker * |
worker = nullptr |
|
) |
| |
|
static |
Detects the smallest bounding box of opaque pixels in a given frame.
- Parameters
-
frame | The frame in the opaque pixels are determined |
transparentIs0xFF | True, if 0xFF is interpreted as a full transparent pixel |
worker | Optional worker object to distribute the computation |
- Returns
- Resulting smallest bounding box, an invalid bounding box if no opaque pixel has been found
◆ detectOpaqueBoundingBox() [2/2]
template<typename T >
PixelBoundingBox Ocean::CV::MaskAnalyzer::detectOpaqueBoundingBox |
( |
const T * |
frame, |
|
|
const unsigned int |
width, |
|
|
const unsigned int |
height, |
|
|
const unsigned int |
alphaChannelIndex, |
|
|
const unsigned int |
channels, |
|
|
const T |
fullTransparentValue, |
|
|
const unsigned int |
framePaddingElements, |
|
|
Worker * |
worker = nullptr |
|
) |
| |
|
static |
Detects the smallest bounding box enclosing all opaque pixels in a given frame.
- Parameters
-
frame | The frame in which the bounding box enclosing all opaque pixels is determined, must be valid |
width | The width of the frame in pixel, with range [1, infinity) |
height | The height of the frame in pixel, with range [1, infinity) |
alphaChannelIndex | The index of the alpha channel, with range [0, channels) |
channels | The number of frame channels, with range [1, infinity) |
fullTransparentValue | The alpha pixel value of a full transparent pixel |
framePaddingElements | The number of padding elements at the end of each frame row, in elements, with range [0, infinity) |
worker | Optional worker object to distribute the computation |
- Returns
- The smallest bounding box enclosing all opaque pixels, an invalid bounding box if the frames does not contain an opaque pixel
- Template Parameters
-
T | Data type of each pixel channel value |
◆ detectOpaqueBoundingBoxSubset()
template<typename T >
void Ocean::CV::MaskAnalyzer::detectOpaqueBoundingBoxSubset |
( |
const T * |
frame, |
|
|
const unsigned int |
width, |
|
|
const unsigned int |
height, |
|
|
const unsigned int |
alphaChannelIndex, |
|
|
const unsigned int |
channels, |
|
|
const T |
fullTransparentValue, |
|
|
const unsigned int |
framePaddingElements, |
|
|
unsigned int * |
left, |
|
|
unsigned int * |
top, |
|
|
unsigned int * |
right, |
|
|
unsigned int * |
bottom, |
|
|
Lock * |
lock, |
|
|
const unsigned int |
firstRow, |
|
|
const unsigned int |
numberRows |
|
) |
| |
|
staticprotected |
Detects the smallest bounding box enclosing all opaque pixels in a subset of a given frame.
- Parameters
-
frame | The frame in which the bounding box enclosing all opaque pixels is determined, must be valid |
width | The width of the frame in pixel, with range [1, infinity) |
height | The height of the frame in pixel, with range [1, infinity) |
alphaChannelIndex | The index of the alpha channel, with range [0, channels - 1] |
channels | The number of frame channels, with range [1, infinity) |
fullTransparentValue | The alpha pixel value of a full transparent pixel |
framePaddingElements | The number of padding elements at the end of each frame row, in elements, with range [0, infinity) |
left | Resulting left bounding box position |
top | Resulting top bounding box position |
right | Resulting right bounding box position |
bottom | Resulting bottom bounding box position |
lock | Optional lock if this function is executed distributed within several threads |
firstRow | First row to be handled |
numberRows | Number of rows to be handled |
- Template Parameters
-
T | Data type of each pixel channel value |
◆ hasValue()
bool Ocean::CV::MaskAnalyzer::hasValue |
( |
const uint8_t * |
mask, |
|
|
const unsigned int |
width, |
|
|
const unsigned int |
height, |
|
|
const uint8_t |
value, |
|
|
const unsigned int |
maskPaddingElements, |
|
|
const PixelBoundingBox & |
boundingBox = CV::PixelBoundingBox() |
|
) |
| |
|
inlinestatic |
Returns whether a mask frame has at least one pixel with a specific mask value.
- Parameters
-
mask | The 8 bit mask frame in which the pixel value is sought, must be valid |
width | The width of the mask frame in pixel, with range [1, infinity) |
height | The height of the mask frame in pixel, with range [1, infinity) |
value | The value to be sought, with range [0, 255] |
maskPaddingElements | The number of padding elements at the end of each mask row, in elements, with range [0, infinity) |
boundingBox | Optional bounding box to speedup the computation, must fit into the given frame if defined |
- Returns
- True, if at least one mask pixel has the specified value
The documentation for this class was generated from the following file: