Ocean
|
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 () |
This class implements functions normalizing frames.
|
inlinestaticprivate |
Returns the smallest epsilon larger than zero for a specific data type.
T | Data type for that the epsilon is requested |
|
inlinestaticprivate |
|
inlinestaticprivate |
|
inlinestaticprivate |
Normalizes a given 1 channel float frame to the 8 bit value range [0, 255] linearly.
source | The source frame to be normalized, must be valid |
target | The normalized frame, 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) |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
worker | Optional worker object to distribute the computation |
T | The data type of each source pixel, must be a floating point type |
|
staticprivate |
Normalizes a subset of a given 1 channel frame to the 8 bit value range [0, 255] linearly.
source | The source frame to be normalized, must be valid |
target | The normalized frame, 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) |
minimalValue | Minimal value that have been determined already |
range | The range between maximal and minimal value [maximalValue - minimalValue] |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
firstRow | First row to be handled, with range [0, height - 1] |
numberRows | Number rows to be handled, with range [1, height - firstRow] |
T | Data type of each pixel, must be a floating point type |
TRange | The data type of the range value, either 'float' or 'double' |
|
inlinestaticprivate |
Normalizes a given 1 channel integer frame to the 8 bit value range [0, 255] linearly.
source | The source frame to be normalized, must be valid |
target | The normalized frame, 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) |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
worker | Optional worker object to distribute the computation |
T | The data type of each source pixel, must be an integer type |
|
staticprivate |
Normalizes a subset of a given 1 channel frame to the 8 bit value range [0, 255] linearly.
source | The source frame to be normalized, must be valid |
target | The normalized frame, 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) |
minimalValue | Minimal value that have been determined already |
range | The range between maximal and minimal value [maximalValue - minimalValue] |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
firstRow | First row to be handled, with range [0, height - 1] |
numberRows | Number rows to be handled, with range [1, height - firstRow] |
T | Data type of each pixel, must be an integer type |
|
inlinestatic |
|
inlinestatic |
|
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
source | The source frame to be normalized, must be valid |
target | The normalized frame, 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) |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
worker | Optional worker object to distribute the computation |
T | The data type of each source pixel |
|
static |
Normalizes a given 1 channel frame to float values with value range [0, 1] logarithmically.
source | The source frame to be normalized, must be valid |
target | The target frame with floating point precision receiving the normalized frame, 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) |
octaves | Scalar that specifies the logarithmic display range, with range (0, 10] |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
worker | Optional worker object to distribute the computation |
TSource | The data type of each source pixel, can be an integer or floating point data type |
TTarget | The data type of each target pixel, must be a floating point data type |
|
staticprivate |
Normalizes a subset of a given 1 channel frame to the value range [0, 1] logarithmically.
source | The source frame to be normalizes, must be valid |
target | The target frame with floating point precision receiving the normalized frame, 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) |
octaves | Scalar that specifies the logarithmic display range, with range (0, 10] |
minimalValue | Minimal value that have been determined already |
range | The range between maximal and minimal value [maximal - minimal] |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
firstRow | First row to be handled, with range [0, height - 1] |
numberRows | Number rows to be handled, with range [1, height - firstRow] |
TSource | The data type of each source pixel, can be an integer or floating point data type |
TTarget | The data type of each target pixel, must be a floating point data type |
|
static |
Normalizes a given 1 channel frame to the 8 bit value range [0, 255] logarithmically.
source | The source frame to be normalized, must be valid |
target | The target frame receiving the normalized frame, 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) |
octaves | Scalar that specifies the logarithmic display range, with range (0, 10] |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
worker | Optional worker object to distribute the computation |
T | Data type of each pixel |
|
staticprivate |
Normalizes a subset of a given 1 channel frame to the 8 bit value range [0, 255] logarithmically.
source | The source frame to be normalizes, must be valid |
target | The target frame receiving the normalized frame, 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) |
octaves | Scalar that specifies the logarithmic display range, with range (0, 10] |
minimalValue | Minimal value that have been determined already |
range | The range between maximal and minimal value [maximal - minimal] |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
firstRow | First row to be handled, with range [0, height - 1] |
numberRows | Number rows to be handled, with range [1, height - firstRow] |
T | Data type of each pixel |
TRange | The data type of the range value, either 'float' or 'double' |
|
static |
Normalizes a given frame logarithmically to a float32 image.
source | The source frame to be normalized, must be valid |
target | The 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 |
octaves | Scalar that specifies the logarithmic display range, with range (0, 10] |
worker | Optional worker object to distribute the computation |
|
static |
Normalizes a given frame linearly to a float32 image.
frame | The frame to be normalized |
octaves | Scalar that specifies the logarithmic display range, with range (0, 10] |
worker | Optional worker object to distribute the computation |
|
static |
Normalizes a given frame logarithmically to a uint8 image.
source | The source frame to be normalized, must be valid |
target | The 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 |
octaves | Scalar that specifies the logarithmic display range, with range (0, 10] |
worker | Optional worker object to distribute the computation |
|
static |
Normalizes a given frame linearly to a uint8 image.
frame | The frame to be normalized |
octaves | Scalar that specifies the logarithmic display range, with range (0, 10] |
worker | Optional worker object to distribute the computation |
|
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.
source | The source frame to be normalized, must be valid |
target | The normalized frame, must be valid |
width | The width of the frame in pixels, with range [1, infinity) |
height | The height of the frame in pixels, with range [1, infinity) |
bias | The bias values, must be valid and have tChannels elements |
scale | The scale value, must be valid and have tChannels elements |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
worker | Optional worker object to distribute the computation |
TSource | The data type of each source pixel, can be an integer or floating point data type |
TTarget | The data type of each target pixel, must be a floating point data type |
tChannels | Number of channels of the frame, with range [1, infinity) |
|
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.
source | The source frame to be normalized, must be valid |
target | The normalized frame, must be valid |
width | The width of the frame in pixels, with range [1, infinity) |
height | The height of the frame in pixels, with range [1, infinity) |
channels | Number of channels of the frame, with range [1, infinity) |
bias | The bias values, must be valid and have channels elements |
scale | The scale value, must be valid and have channels elements |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
worker | Optional worker object to distribute the computation |
TSource | The data type of each source pixel, can be an integer or floating point data type |
TTarget | The data type of each target pixel, must be a floating point data type |
|
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.
source | The source frame to be normalized, must have one channel, must be valid |
target | The resulting normalized frame; will have the same frame type as source but with data type FrameType::DT_SIGNED_FLOAT_32 |
bias | The bias values, if valid it must have source.channels() elements |
scale | The scale value, if valid it must have source.channels() elements |
worker | Optional worker object to distribute the computation |
|
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.
source | The source frame to be normalized, must have one channel, must be valid |
target | The resulting normalized frame; will have the same frame type as source but with data type FrameType::DT_SIGNED_FLOAT_32 |
worker | Optional worker object to distribute the computation |
|
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
frame | The frame to be normalized, must have one channel, must be valid |
worker | Optional worker object to distribute the computation |
|
staticprivate |
Normalizes a subset of rows of a frame to float values by using predefined per-channel bias and scaling values.
source | The source frame to be normalized, must be valid |
target | The normalized frame with floating point precision, 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) |
bias | The bias values, must be valid and have tChannels elements |
scale | The scale value, must be valid and have tChannels elements |
sourcePaddingElements | Optional number of padding elements at the end of each source row, in elements, with range [0, infinity) |
targetPaddingElements | Optional number of padding elements at the end of each target row, in elements, with range [0, infinity) |
firstRow | First row to be handled, with range [0, height - 1] |
numberRows | Number rows to be handled, with range [1, height - firstRow] |
TSource | The data type of each source pixel, can be an integer or floating point data type |
TTarget | The data type of each target pixel, must be a floating point data type |
tChannels | Number of channels of the frame, with range [1, infinity) |
|
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
source | The source frame to be normalized, must have one channel, must be valid |
target | The resulting normalized frame with pixel format FORMAT_Y8 |
worker | Optional worker object to distribute the computation |
|
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
frame | The frame to be normalized, must have one channel, must be valid |
worker | Optional worker object to distribute the computation |