Ocean
Ocean::CV::FrameMinMax Class Reference

This class implements functions allowing to determine minimum and maximum values within frames. More...

Data Structures

class  ExtremumDeterminer
 This class allows to determine the extremum (the global minimum or maximum) within a given frame. More...
 

Static Public Member Functions

template<typename T >
static void determineMinValue (const T *frame, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, T *minValue=nullptr, PixelPosition *minLocation=nullptr)
 Determines the minimum value (the global minimum) within a given frame with one channel. More...
 
template<typename T >
static void determineMaxValue (const T *frame, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, T *maxValue=nullptr, PixelPosition *maxLocation=nullptr)
 Determines the maximum value (the peak value) within a given frame with one channel. More...
 
template<typename T , unsigned int tChannels, bool tIgnoreInfinity = false>
static void determineMinMaxValues (const T *frame, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, T *minimalValues, T *maximalValues, Worker *worker=nullptr)
 Determines the minimal and maximal pixel values in a given frame. More...
 
template<typename T >
static bool countElementsOutsideRange (const T *frame, const uint32_t width, const uint32_t height, const uint32_t framePaddingElements, const T rangeStart, const T rangeEnd, uint32_t *elementsBelowRange=nullptr, uint32_t *elementsAboveRange=nullptr)
 Counts frame elements in a 1-channel frame that are outside a specified range of values. More...
 
template<>
bool countElementsOutsideRange (const uint8_t *frame, const uint32_t width, const uint32_t height, const uint32_t framePaddingElements, const uint8_t rangeStart, const uint8_t rangeEnd, uint32_t *elementsBelowRange, uint32_t *elementsAboveRange)
 Forward declaration of template socialization. More...
 

Static Protected Member Functions

template<typename T , unsigned int tChannels, bool tIgnoreInfinity = false>
static void determineMinMaxValuesSubset (const T *frame, const unsigned int width, const unsigned int height, T *minimalValues, T *maximalValues, Lock *lock, const unsigned int framePaddingElements, const unsigned int firstRow, const unsigned int numberRows)
 Determines the minimal and maximal pixel values in a subset of a given frame. More...
 

Detailed Description

This class implements functions allowing to determine minimum and maximum values within frames.

Member Function Documentation

◆ countElementsOutsideRange() [1/2]

template<typename T >
bool Ocean::CV::FrameMinMax::countElementsOutsideRange ( const T *  frame,
const uint32_t  width,
const uint32_t  height,
const uint32_t  framePaddingElements,
const T  rangeStart,
const T  rangeEnd,
uint32_t *  elementsBelowRange = nullptr,
uint32_t *  elementsAboveRange = nullptr 
)
static

Counts frame elements in a 1-channel frame that are outside a specified range of values.

Parameters
frameThe pointer to the first pixel of the frame, must be valid
widthThe width of the given frame in pixel, with range [1, infinity)
heightThe height of the given frame in pixel, with range [1, infinity)
framePaddingElementsThe number of padding elements at the end of each frame row, in elements, with range [0, infinity)
rangeStartStart value of the range, range: [lowest<T>(), rangeEnd]
rangeEndExclusive end value of the range, range: [rangeStart, max<T>()]
elementsBelowRangeOptional resulting number of elements with values < rangeStart
elementsAboveRangeOptional resulting number of elements with values >= rangeEnd
Returns
True on success, otherwise false

◆ countElementsOutsideRange() [2/2]

template<>
bool Ocean::CV::FrameMinMax::countElementsOutsideRange ( const uint8_t *  frame,
const uint32_t  width,
const uint32_t  height,
const uint32_t  framePaddingElements,
const uint8_t  rangeStart,
const uint8_t  rangeEnd,
uint32_t *  elementsBelowRange,
uint32_t *  elementsAboveRange 
)
static

Forward declaration of template socialization.

◆ determineMaxValue()

template<typename T >
void Ocean::CV::FrameMinMax::determineMaxValue ( const T *  frame,
const unsigned int  width,
const unsigned int  height,
const unsigned int  framePaddingElements,
T *  maxValue = nullptr,
PixelPosition maxLocation = nullptr 
)
static

Determines the maximum value (the peak value) within a given frame with one channel.

In case several locations with same peak value exist, one of them will be returned.
This function supports a padding at the end of each row, in case a padding is specified the actual memory must have size: (width + paddingElements) * sizeof(T) * height.
Information: This function is the equivalent to OpenCV's cv::minMaxLoc() - but significantly faster.

Parameters
frameThe pointer to the first pixel of the frame, must be valid
widthThe width of the given frame in pixel, with range [1, infinity)
heightThe height of the given frame in pixel, with range [1, infinity)
framePaddingElementsThe number of padding elements at the end of each frame row, in elements, with range [0, infinity)
maxValueOptional resulting maximal value found within the frame, 'nullptr' otherwise
maxLocationOptional resulting position where the maximal value is located, with range [0, width - 1]x[0, height - 1], 'nullptr' otherwise
Template Parameters
TThe data type of each pixel e.g., 'unsigned char', 'int', 'float'

◆ determineMinMaxValues()

template<typename T , unsigned int tChannels, bool tIgnoreInfinity>
void Ocean::CV::FrameMinMax::determineMinMaxValues ( const T *  frame,
const unsigned int  width,
const unsigned int  height,
const unsigned int  framePaddingElements,
T *  minimalValues,
T *  maximalValues,
Worker worker = nullptr 
)
inlinestatic

Determines the minimal and maximal pixel values in a given frame.

In case the frame has multiple channels, minimal and maximal values are determined for each channel individually.

Parameters
frameThe frame for which the minimal and maximal pixel values are determined, must be valid
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
framePaddingElementsThe number of padding elements at the end of each frame row, in elements, with range [0, infinity)
minimalValuesResulting minimal values, one for each channel, must be valid
maximalValuesResulting maximal values, one for each channel, must be valid
workerOptional worker object to distribute the computation
Template Parameters
TData type of each pixel color value (per channel)
tChannelsNumber of channels of the frame, with range [1, infinity)
tIgnoreInfinityTrue, to ignore +/- infinity and NaN float values; False, to consider +/- infinity float as minimum and maximum values as well, beahvior with NaN values is undefined

◆ determineMinMaxValuesSubset()

template<typename T , unsigned int tChannels, bool tIgnoreInfinity>
void Ocean::CV::FrameMinMax::determineMinMaxValuesSubset ( const T *  frame,
const unsigned int  width,
const unsigned int  height,
T *  minimalValues,
T *  maximalValues,
Lock lock,
const unsigned int  framePaddingElements,
const unsigned int  firstRow,
const unsigned int  numberRows 
)
staticprotected

Determines the minimal and maximal pixel values in a subset of a given frame.

Parameters
frameThe frame for which the minimal and maximal pixel values are determined, must be valid
widthThe width of the frame in pixel, with range [1, infinity)
heightThe height of the frame in pixel, with range [1, infinity)
minimalValuesResulting minimal values
maximalValuesResulting maximal values
lockOptional lock if this function is executed distributed within several threads
framePaddingElementsThe number of padding elements at the end of each frame row, in elements, with range [0, infinity)
firstRowFirst row to be handled, with range [0, height - 1]
numberRowsNumber of rows to be handled, with range [1, height - firstRow]
Template Parameters
TData type of each pixel color value (per channel)
tChannelsNumber of channels of the frame, with range [1, infinity)
tIgnoreInfinityTrue, to ignore +/- inf values; False, to consider +/- inf as minimum and maximum values as well

◆ determineMinValue()

template<typename T >
void Ocean::CV::FrameMinMax::determineMinValue ( const T *  frame,
const unsigned int  width,
const unsigned int  height,
const unsigned int  framePaddingElements,
T *  minValue = nullptr,
PixelPosition minLocation = nullptr 
)
static

Determines the minimum value (the global minimum) within a given frame with one channel.

In case several locations with same value exist, one of them will be returned.
This function supports a padding at the end of each row, in case a padding is specified the actual memory must have size: (width + paddingElements) * sizeof(T) * height.
Information: This function is the equivalent to OpenCV's cv::minMaxLoc() - but significantly faster.

Parameters
frameThe pointer to the first pixel of the frame, must be valid
widthThe width of the given frame in pixel, with range [1, infinity)
heightThe height of the given frame in pixel, with range [1, infinity)
framePaddingElementsThe number of padding elements at the end of each frame row, in elements, with range [0, infinity)
minValueOptional resulting minimal value found within the frame, 'nullptr' otherwise
minLocationOptional resulting position where the minimal value is located, with range [0, width - 1]x[0, height - 1], 'nullptr' otherwise
Template Parameters
TThe data type of each pixel e.g., 'unsigned char', 'int', 'float'

The documentation for this class was generated from the following file: