Ocean
Ocean::CV::FrameNormalizer Class Reference

This class implements functions normalizing frames. More...

Data Structures

struct  DataTypeMultiple255
 Helper struct allowing to determine the type able to store data multiplied by 255. More...
 
struct  DataTypeMultiple255< float >
 
struct  DataTypeMultiple255< uint64_t >
 
struct  FloatType
 Helper struct allowing to determine the necessary float type for a given data type. More...
 
struct  FloatType< double >
 Specialization of the helper struct. More...
 

Static Public Member Functions

static bool normalizeToUint8 (const Frame &source, Frame &target, Worker *worker=nullptr)
 Normalizes a given 1-channel frame linearly to a uint8 image. More...
 
static bool normalizeToFloat32 (const Frame &source, Frame &target, Worker *worker=nullptr)
 Normalizes each channel of a frame linearly to a float32 image to the range [0, 1]. More...
 
static bool normalizeToFloat32 (const Frame &source, Frame &target, const float *bias, const float *scale, Worker *worker=nullptr)
 Normalizes a given frame linearly to a float32 image. More...
 
static bool normalizeLogarithmToUint8 (const Frame &source, Frame &target, const Scalar octaves=5.0f, Worker *worker=nullptr)
 Normalizes a given frame logarithmically to a uint8 image. More...
 
static bool normalizeLogarithmToFloat32 (const Frame &source, Frame &target, const Scalar octaves=5.0f, Worker *worker=nullptr)
 Normalizes a given frame logarithmically to a float32 image. More...
 
static bool normalizeToUint8 (Frame &frame, Worker *worker=nullptr)
 Normalizes a given 1-channel frame linearly to a uint8 image. More...
 
static bool normalizeToFloat32 (Frame &frame, Worker *worker=nullptr)
 Normalizes a given 1-channel frame linearly to a float32 image. More...
 
static bool normalizeLogarithmToUint8 (Frame &frame, const Scalar octaves=5.0f, Worker *worker=nullptr)
 Normalizes a given frame linearly to a uint8 image. More...
 
static bool normalizeLogarithmToFloat32 (Frame &frame, const Scalar octaves=5.0f, Worker *worker=nullptr)
 Normalizes a given frame linearly to a float32 image. More...
 
template<typename T >
static void normalize1ChannelToUint8 (const T *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Normalizes a given 1 channel frame to the 8 bit value range [0, 255] linearly. More...
 
template<typename TSource , typename TTarget , unsigned int tChannels>
static void normalizeToFloat (const TSource *source, TTarget *target, const unsigned int width, const unsigned int height, const TTarget *bias, const TTarget *scale, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Normalizes a frame to float values by using predefined per-channel bias and scaling values. More...
 
template<typename T >
static void normalizeLogarithm1ChannelToUint8 (const T *source, uint8_t *target, const unsigned int width, const unsigned int height, const Scalar octaves, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Normalizes a given 1 channel frame to the 8 bit value range [0, 255] logarithmically. More...
 
template<typename TSource , typename TTarget >
static void normalizeLogarithm1ChannelToFloat (const TSource *source, TTarget *target, const unsigned int width, const unsigned int height, const Scalar octaves, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Normalizes a given 1 channel frame to float values with value range [0, 1] logarithmically. More...
 
template<>
void normalize1ChannelToUint8 (const float *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker)
 
template<>
void normalize1ChannelToUint8 (const double *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker)
 

Static Private Member Functions

template<typename T >
static void normalize1ChannelIntegerToUint8 (const T *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Normalizes a given 1 channel integer frame to the 8 bit value range [0, 255] linearly. More...
 
template<typename T >
static void normalize1ChannelFloatToUint8 (const T *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Normalizes a given 1 channel float frame to the 8 bit value range [0, 255] linearly. More...
 
template<typename TSource , typename TTarget >
static bool normalizeToFloat (const TSource *source, TTarget *target, const unsigned int width, const unsigned int height, const unsigned int channels, const TTarget *bias, const TTarget *scale, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
 Normalizes a frame to float values by using predefined per-channel bias and scaling values. More...
 
template<typename T >
static void normalize1ChannelIntegerToUint8Subset (const T *source, uint8_t *target, const unsigned int width, const unsigned int height, const T minimalValue, const typename UnsignedTyper< T >::Type range, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows)
 Normalizes a subset of a given 1 channel frame to the 8 bit value range [0, 255] linearly. More...
 
template<typename T , typename TRange >
static void normalize1ChannelFloatToUint8Subset (const T *source, uint8_t *target, const unsigned int width, const unsigned int height, const T minimalValue, const TRange range, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows)
 Normalizes a subset of a given 1 channel frame to the 8 bit value range [0, 255] linearly. More...
 
template<typename TSource , typename TTarget , unsigned int tChannels>
static void normalizeToFloatSubset (const TSource *source, TTarget *target, const unsigned int width, const unsigned int height, const TTarget *bias, const TTarget *scale, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows)
 Normalizes a subset of rows of a frame to float values by using predefined per-channel bias and scaling values. More...
 
template<typename T , typename TRange >
static void normalizeLogarithm1ChannelToUint8Subset (const T *source, uint8_t *target, const unsigned int width, const unsigned int height, const Scalar octaves, const T minimalValue, const TRange range, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows)
 Normalizes a subset of a given 1 channel frame to the 8 bit value range [0, 255] logarithmically. More...
 
template<typename TSource , typename TTarget >
static void normalizeLogarithm1ChannelToFloatSubset (const TSource *source, TTarget *target, const unsigned int width, const unsigned int height, const Scalar octaves, const TTarget minimalValue, const TTarget range, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows)
 Normalizes a subset of a given 1 channel frame to the value range [0, 1] logarithmically. More...
 
template<typename T >
static T epsilon ()
 Returns the smallest epsilon larger than zero for a specific data type. More...
 
template<>
float epsilon ()
 
template<>
double epsilon ()
 

Detailed Description

This class implements functions normalizing frames.

Member Function Documentation

◆ epsilon() [1/3]

template<typename T >
T Ocean::CV::FrameNormalizer::epsilon
inlinestaticprivate

Returns the smallest epsilon larger than zero for a specific data type.

Returns
Requested epsilon
Template Parameters
TData type for that the epsilon is requested

◆ epsilon() [2/3]

template<>
float Ocean::CV::FrameNormalizer::epsilon ( )
inlinestaticprivate

◆ epsilon() [3/3]

template<>
double Ocean::CV::FrameNormalizer::epsilon ( )
inlinestaticprivate

◆ normalize1ChannelFloatToUint8()

template<typename T >
void Ocean::CV::FrameNormalizer::normalize1ChannelFloatToUint8 ( const T *  source,
uint8_t *  target,
const unsigned int  width,
const unsigned int  height,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
inlinestaticprivate

Normalizes a given 1 channel float frame to the 8 bit value range [0, 255] linearly.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe normalized frame, 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)
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
workerOptional worker object to distribute the computation
Template Parameters
TThe data type of each source pixel, must be a floating point type

◆ normalize1ChannelFloatToUint8Subset()

template<typename T , typename TRange >
void Ocean::CV::FrameNormalizer::normalize1ChannelFloatToUint8Subset ( const T *  source,
uint8_t *  target,
const unsigned int  width,
const unsigned int  height,
const T  minimalValue,
const TRange  range,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
const unsigned int  firstRow,
const unsigned int  numberRows 
)
staticprivate

Normalizes a subset of a given 1 channel frame to the 8 bit value range [0, 255] linearly.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe normalized frame, 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)
minimalValueMinimal value that have been determined already
rangeThe range between maximal and minimal value [maximalValue - minimalValue]
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
firstRowFirst row to be handled, with range [0, height - 1]
numberRowsNumber rows to be handled, with range [1, height - firstRow]
Template Parameters
TData type of each pixel, must be a floating point type
TRangeThe data type of the range value, either 'float' or 'double'

◆ normalize1ChannelIntegerToUint8()

template<typename T >
void Ocean::CV::FrameNormalizer::normalize1ChannelIntegerToUint8 ( const T *  source,
uint8_t *  target,
const unsigned int  width,
const unsigned int  height,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
inlinestaticprivate

Normalizes a given 1 channel integer frame to the 8 bit value range [0, 255] linearly.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe normalized frame, 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)
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
workerOptional worker object to distribute the computation
Template Parameters
TThe data type of each source pixel, must be an integer type

◆ normalize1ChannelIntegerToUint8Subset()

template<typename T >
void Ocean::CV::FrameNormalizer::normalize1ChannelIntegerToUint8Subset ( const T *  source,
uint8_t *  target,
const unsigned int  width,
const unsigned int  height,
const T  minimalValue,
const typename UnsignedTyper< T >::Type  range,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
const unsigned int  firstRow,
const unsigned int  numberRows 
)
staticprivate

Normalizes a subset of a given 1 channel frame to the 8 bit value range [0, 255] linearly.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe normalized frame, 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)
minimalValueMinimal value that have been determined already
rangeThe range between maximal and minimal value [maximalValue - minimalValue]
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
firstRowFirst row to be handled, with range [0, height - 1]
numberRowsNumber rows to be handled, with range [1, height - firstRow]
Template Parameters
TData type of each pixel, must be an integer type

◆ normalize1ChannelToUint8() [1/3]

template<>
void Ocean::CV::FrameNormalizer::normalize1ChannelToUint8 ( const double *  source,
uint8_t *  target,
const unsigned int  width,
const unsigned int  height,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker 
)
inlinestatic

◆ normalize1ChannelToUint8() [2/3]

template<>
void Ocean::CV::FrameNormalizer::normalize1ChannelToUint8 ( const float *  source,
uint8_t *  target,
const unsigned int  width,
const unsigned int  height,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker 
)
inlinestatic

◆ normalize1ChannelToUint8() [3/3]

template<typename T >
void Ocean::CV::FrameNormalizer::normalize1ChannelToUint8 ( const T *  source,
uint8_t *  target,
const unsigned int  width,
const unsigned int  height,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
static

Normalizes a given 1 channel frame to the 8 bit value range [0, 255] linearly.

The normalization is based on the following equation for each pixel individually:

normalizedPixel = (pixel - minimalPixelValue) / (maximalPixelValue - minimalPixelValue) * 255

with `minimalPixelValue` and `maximalPixelValue` the minimal (or maximal) pixel value within the entire image
Parameters
sourceThe source frame to be normalized, must be valid
targetThe normalized frame, 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)
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
workerOptional worker object to distribute the computation
Template Parameters
TThe data type of each source pixel
See also
normalizeLogarithm1ChannelToUint8(), normalizeToFloat().

◆ normalizeLogarithm1ChannelToFloat()

template<typename TSource , typename TTarget >
void Ocean::CV::FrameNormalizer::normalizeLogarithm1ChannelToFloat ( const TSource *  source,
TTarget *  target,
const unsigned int  width,
const unsigned int  height,
const Scalar  octaves,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
static

Normalizes a given 1 channel frame to float values with value range [0, 1] logarithmically.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe target frame with floating point precision receiving the normalized frame, 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)
octavesScalar that specifies the logarithmic display range, with range (0, 10]
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
workerOptional worker object to distribute the computation
Template Parameters
TSourceThe data type of each source pixel, can be an integer or floating point data type
TTargetThe data type of each target pixel, must be a floating point data type

◆ normalizeLogarithm1ChannelToFloatSubset()

template<typename TSource , typename TTarget >
void Ocean::CV::FrameNormalizer::normalizeLogarithm1ChannelToFloatSubset ( const TSource *  source,
TTarget *  target,
const unsigned int  width,
const unsigned int  height,
const Scalar  octaves,
const TTarget  minimalValue,
const TTarget  range,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
const unsigned int  firstRow,
const unsigned int  numberRows 
)
staticprivate

Normalizes a subset of a given 1 channel frame to the value range [0, 1] logarithmically.

Parameters
sourceThe source frame to be normalizes, must be valid
targetThe target frame with floating point precision receiving the normalized frame, 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)
octavesScalar that specifies the logarithmic display range, with range (0, 10]
minimalValueMinimal value that have been determined already
rangeThe range between maximal and minimal value [maximal - minimal]
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
firstRowFirst row to be handled, with range [0, height - 1]
numberRowsNumber rows to be handled, with range [1, height - firstRow]
Template Parameters
TSourceThe data type of each source pixel, can be an integer or floating point data type
TTargetThe data type of each target pixel, must be a floating point data type

◆ normalizeLogarithm1ChannelToUint8()

template<typename T >
void Ocean::CV::FrameNormalizer::normalizeLogarithm1ChannelToUint8 ( const T *  source,
uint8_t *  target,
const unsigned int  width,
const unsigned int  height,
const Scalar  octaves,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
static

Normalizes a given 1 channel frame to the 8 bit value range [0, 255] logarithmically.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe target frame receiving the normalized frame, 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)
octavesScalar that specifies the logarithmic display range, with range (0, 10]
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
workerOptional worker object to distribute the computation
Template Parameters
TData type of each pixel
See also
normalize1ChannelToUint8().

◆ normalizeLogarithm1ChannelToUint8Subset()

template<typename T , typename TRange >
void Ocean::CV::FrameNormalizer::normalizeLogarithm1ChannelToUint8Subset ( const T *  source,
uint8_t *  target,
const unsigned int  width,
const unsigned int  height,
const Scalar  octaves,
const T  minimalValue,
const TRange  range,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
const unsigned int  firstRow,
const unsigned int  numberRows 
)
staticprivate

Normalizes a subset of a given 1 channel frame to the 8 bit value range [0, 255] logarithmically.

Parameters
sourceThe source frame to be normalizes, must be valid
targetThe target frame receiving the normalized frame, 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)
octavesScalar that specifies the logarithmic display range, with range (0, 10]
minimalValueMinimal value that have been determined already
rangeThe range between maximal and minimal value [maximal - minimal]
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
firstRowFirst row to be handled, with range [0, height - 1]
numberRowsNumber rows to be handled, with range [1, height - firstRow]
Template Parameters
TData type of each pixel
TRangeThe data type of the range value, either 'float' or 'double'

◆ normalizeLogarithmToFloat32() [1/2]

static bool Ocean::CV::FrameNormalizer::normalizeLogarithmToFloat32 ( const Frame source,
Frame target,
const Scalar  octaves = 5.0f,
Worker worker = nullptr 
)
static

Normalizes a given frame logarithmically to a float32 image.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe target frame receiving the normalized values, will be adjusted to the correct frame type if it does not have the correct pixel format and pixel origin
octavesScalar that specifies the logarithmic display range, with range (0, 10]
workerOptional worker object to distribute the computation
Returns
True, if succeeded

◆ normalizeLogarithmToFloat32() [2/2]

static bool Ocean::CV::FrameNormalizer::normalizeLogarithmToFloat32 ( Frame frame,
const Scalar  octaves = 5.0f,
Worker worker = nullptr 
)
static

Normalizes a given frame linearly to a float32 image.

Parameters
frameThe frame to be normalized
octavesScalar that specifies the logarithmic display range, with range (0, 10]
workerOptional worker object to distribute the computation
Returns
True, if succeeded

◆ normalizeLogarithmToUint8() [1/2]

static bool Ocean::CV::FrameNormalizer::normalizeLogarithmToUint8 ( const Frame source,
Frame target,
const Scalar  octaves = 5.0f,
Worker worker = nullptr 
)
static

Normalizes a given frame logarithmically to a uint8 image.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe target frame receiving the normalized values, will be adjusted to the correct frame type if it does not have the correct pixel format and pixel origin
octavesScalar that specifies the logarithmic display range, with range (0, 10]
workerOptional worker object to distribute the computation
Returns
True, if succeeded

◆ normalizeLogarithmToUint8() [2/2]

static bool Ocean::CV::FrameNormalizer::normalizeLogarithmToUint8 ( Frame frame,
const Scalar  octaves = 5.0f,
Worker worker = nullptr 
)
static

Normalizes a given frame linearly to a uint8 image.

Parameters
frameThe frame to be normalized
octavesScalar that specifies the logarithmic display range, with range (0, 10]
workerOptional worker object to distribute the computation
Returns
True, if succeeded

◆ normalizeToFloat() [1/2]

template<typename TSource , typename TTarget , unsigned int tChannels>
void Ocean::CV::FrameNormalizer::normalizeToFloat ( const TSource *  source,
TTarget *  target,
const unsigned int  width,
const unsigned int  height,
const TTarget *  bias,
const TTarget *  scale,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
static

Normalizes a frame to float values by using predefined per-channel bias and scaling values.

If both, bias and scale are valid, the normalization is based on the following equation for each pixel individually:

normalizedPixel[channel] = (pixel[channel] + bias[channel]) * scale[channel]

if either or both are nullptr, the normalization is as follows:

normalizedPixel[channel] = (pixel[channel] - minimalPixelValues[channel]) / (maximalPixelValues[channel] - minimalPixelValues[channel])

with minimalPixelValues[channel] and maximalPixelValues[channel] being the minimum and maximum pixel values of each channel of the image.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe normalized frame, must be valid
widthThe width of the frame in pixels, with range [1, infinity)
heightThe height of the frame in pixels, with range [1, infinity)
biasThe bias values, must be valid and have tChannels elements
scaleThe scale value, must be valid and have tChannels elements
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
workerOptional worker object to distribute the computation
Template Parameters
TSourceThe data type of each source pixel, can be an integer or floating point data type
TTargetThe data type of each target pixel, must be a floating point data type
tChannelsNumber of channels of the frame, with range [1, infinity)

◆ normalizeToFloat() [2/2]

template<typename TSource , typename TTarget >
bool Ocean::CV::FrameNormalizer::normalizeToFloat ( const TSource *  source,
TTarget *  target,
const unsigned int  width,
const unsigned int  height,
const unsigned int  channels,
const TTarget *  bias,
const TTarget *  scale,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
Worker worker = nullptr 
)
staticprivate

Normalizes a frame to float values by using predefined per-channel bias and scaling values.

If both, bias and scale are valid, the normalization is based on the following equation for each pixel individually:

normalizedPixel[channel] = (pixel[channel] + bias[channel]) * scale[channel]

if either or both are nullptr, the normalization is as follows:

normalizedPixel[channel] = (pixel[channel] - minimalPixelValues[channel]) / (maximalPixelValues[channel] - minimalPixelValues[channel])

with minimalPixelValues[channel] and maximalPixelValues[channel] being the minimum and maximum pixel values of each channel of the image.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe normalized frame, must be valid
widthThe width of the frame in pixels, with range [1, infinity)
heightThe height of the frame in pixels, with range [1, infinity)
channelsNumber of channels of the frame, with range [1, infinity)
biasThe bias values, must be valid and have channels elements
scaleThe scale value, must be valid and have channels elements
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
workerOptional worker object to distribute the computation
Returns
True if the normalization was successful, otherwise false
Template Parameters
TSourceThe data type of each source pixel, can be an integer or floating point data type
TTargetThe data type of each target pixel, must be a floating point data type

◆ normalizeToFloat32() [1/3]

static bool Ocean::CV::FrameNormalizer::normalizeToFloat32 ( const Frame source,
Frame target,
const float *  bias,
const float *  scale,
Worker worker = nullptr 
)
static

Normalizes a given frame linearly to a float32 image.

If both, bias and scale are valid, the normalization is based on the following equation for each pixel individually:

normalizedPixel[channel] = (pixel[channel] + bias[channel]) * scale[channel]

if either or both are nullptr, the normalization is as follows:

normalizedPixel[channel] = (pixel[channel] - minimalPixelValues[channel]) / (maximalPixelValues[channel] - minimalPixelValues[channel])

with minimalPixelValues[channel] and maximalPixelValues[channel] being the minimum and maximum pixel values of each channel of the image.

Parameters
sourceThe source frame to be normalized, must have one channel, must be valid
targetThe resulting normalized frame; will have the same frame type as source but with data type FrameType::DT_SIGNED_FLOAT_32
biasThe bias values, if valid it must have source.channels() elements
scaleThe scale value, if valid it must have source.channels() elements
workerOptional worker object to distribute the computation
Returns
True, if succeeded

◆ normalizeToFloat32() [2/3]

static bool Ocean::CV::FrameNormalizer::normalizeToFloat32 ( const Frame source,
Frame target,
Worker worker = nullptr 
)
static

Normalizes each channel of a frame linearly to a float32 image to the range [0, 1].

The normalization is based on the following equation for each pixel individually:

normalizedPixel[channel] = (pixel[channel] - minimalPixelValues[channel]) / (maximalPixelValues[channel] - minimalPixelValues[channel])

with minimalPixelValues[channel] and maximalPixelValues[channel] being the minimum and maximum pixel values of a channel of the image.

Parameters
sourceThe source frame to be normalized, must have one channel, must be valid
targetThe resulting normalized frame; will have the same frame type as source but with data type FrameType::DT_SIGNED_FLOAT_32
workerOptional worker object to distribute the computation
Returns
True, if succeeded

◆ normalizeToFloat32() [3/3]

static bool Ocean::CV::FrameNormalizer::normalizeToFloat32 ( Frame frame,
Worker worker = nullptr 
)
static

Normalizes a given 1-channel frame linearly to a float32 image.

The normalization is based on the following equation for each pixel individually:

normalizedPixel = (pixel - minimalPixelValue) / (maximalPixelValue - minimalPixelValue) * 255

with `minimalPixelValue` and `maximalPixelValue` the minimal (or maximal) pixel value within the entire image
Parameters
frameThe frame to be normalized, must have one channel, must be valid
workerOptional worker object to distribute the computation
Returns
True, if succeeded

◆ normalizeToFloatSubset()

template<typename TSource , typename TTarget , unsigned int tChannels>
void Ocean::CV::FrameNormalizer::normalizeToFloatSubset ( const TSource *  source,
TTarget *  target,
const unsigned int  width,
const unsigned int  height,
const TTarget *  bias,
const TTarget *  scale,
const unsigned int  sourcePaddingElements,
const unsigned int  targetPaddingElements,
const unsigned int  firstRow,
const unsigned int  numberRows 
)
staticprivate

Normalizes a subset of rows of a frame to float values by using predefined per-channel bias and scaling values.

Parameters
sourceThe source frame to be normalized, must be valid
targetThe normalized frame with floating point precision, 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)
biasThe bias values, must be valid and have tChannels elements
scaleThe scale value, must be valid and have tChannels elements
sourcePaddingElementsOptional number of padding elements at the end of each source row, in elements, with range [0, infinity)
targetPaddingElementsOptional number of padding elements at the end of each target row, in elements, with range [0, infinity)
firstRowFirst row to be handled, with range [0, height - 1]
numberRowsNumber rows to be handled, with range [1, height - firstRow]
Template Parameters
TSourceThe data type of each source pixel, can be an integer or floating point data type
TTargetThe data type of each target pixel, must be a floating point data type
tChannelsNumber of channels of the frame, with range [1, infinity)

◆ normalizeToUint8() [1/2]

static bool Ocean::CV::FrameNormalizer::normalizeToUint8 ( const Frame source,
Frame target,
Worker worker = nullptr 
)
static

Normalizes a given 1-channel frame linearly to a uint8 image.

The normalization is based on the following equation for each pixel individually:

normalizedPixel = (pixel - minimalPixelValue) / (maximalPixelValue - minimalPixelValue) * 255

with `minimalPixelValue` and `maximalPixelValue` the minimal (or maximal) pixel value within the entire image
Parameters
sourceThe source frame to be normalized, must have one channel, must be valid
targetThe resulting normalized frame with pixel format FORMAT_Y8
workerOptional worker object to distribute the computation
Returns
True, if succeeded

◆ normalizeToUint8() [2/2]

static bool Ocean::CV::FrameNormalizer::normalizeToUint8 ( Frame frame,
Worker worker = nullptr 
)
static

Normalizes a given 1-channel frame linearly to a uint8 image.

The normalization is based on the following equation for each pixel individually:

normalizedPixel = (pixel - minimalPixelValue) / (maximalPixelValue - minimalPixelValue) * 255

with `minimalPixelValue` and `maximalPixelValue` the minimal (or maximal) pixel value within the entire image
Parameters
frameThe frame to be normalized, must have one channel, must be valid
workerOptional worker object to distribute the computation
Returns
True, if succeeded

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