8 #ifndef META_OCEAN_TEST_TESTCV_FRAME_CONVERTER_TEST_UTILITIES_H
9 #define META_OCEAN_TEST_TESTCV_FRAME_CONVERTER_TEST_UTILITIES_H
58 inline uint8_t alphaValue()
const;
64 inline float gammaValue()
const;
129 FT_3_UINT8_TO_1_UINT8_ALPHA
135 template <
typename TSource,
typename TTarget>
141 template <
typename TSource,
typename TTarget>
147 template <
typename TSource,
typename TTarget>
153 template <
typename TSource,
typename TTarget>
154 using OneSourceOneTargetBlackLevelWhiteBalanceGammaConversionFunction = void(*)(
const TSource* source, TTarget* target,
const unsigned int width,
const unsigned int height,
const ConversionFlag conversionFlag,
const uint16_t blackLevel,
const float* whiteBalance,
const float gamma,
const uint32_t sourcePaddingElements,
const uint32_t targetPaddingElements,
Worker* worker);
159 template <
typename TSource,
typename TTarget>
160 using OneSourceTwoTargetsConversionFunction = void(*)(
const TSource* source, TTarget* target0, TTarget* target1,
const uint32_t width,
const uint32_t height,
const ConversionFlag conversionFlag,
const uint32_t sourcePaddingElements,
const uint32_t target0PaddingElements,
const uint32_t target1PaddingElements,
Worker* worker);
165 template <
typename TSource,
typename TTarget>
166 using OneSourceThreeTargetsConversionFunction = void(*)(
const TSource* source, TTarget* target0, TTarget* target1, TTarget* target2,
const uint32_t width,
const uint32_t height,
const ConversionFlag conversionFlag,
const uint32_t sourcePaddingElements,
const uint32_t target0PaddingElements,
const uint32_t target1PaddingElements,
const uint32_t target2PaddingElements,
Worker* worker);
171 template <
typename TSource,
typename TTarget>
172 using TwoSourcesOneTargetConversionFunction = void(*)(
const TSource* source0,
const TSource* source1, TTarget* target,
const uint32_t width,
const uint32_t height,
const ConversionFlag conversionFlag,
const uint32_t source0PaddingElements,
const uint32_t source1PaddingElements,
const uint32_t targetPaddingElements,
Worker* worker);
177 template <
typename TSource,
typename TTarget>
178 using TwoSourcesThreeTargetConversionFunction = void(*)(
const TSource* source0,
const TSource* source1, TTarget* target0, TTarget* target1, TTarget* target2,
const uint32_t width,
const uint32_t height,
const ConversionFlag conversionFlag,
const uint32_t source0PaddingElements,
const uint32_t source1PaddingElements,
const uint32_t targetPaddingElements0,
const uint32_t targetPaddingElements1,
const uint32_t targetPaddingElements2,
Worker* worker);
183 template <
typename TSource,
typename TTarget>
184 using TwoSourcesOneTargetAlphaConversionFunction = void(*)(
const TSource* source0,
const TSource* source1, TTarget* target,
const uint32_t width,
const uint32_t height,
const ConversionFlag conversionFlag,
const uint32_t source0PaddingElements,
const uint32_t source1PaddingElements,
const uint32_t targetPaddingElements,
const TTarget alpha,
Worker* worker);
189 template <
typename TSource,
typename TTarget>
190 using ThreeSourcesOneTargetConversionFunction = void(*)(
const TSource* source0,
const TSource* source1,
const TSource* source2, TTarget* target,
const uint32_t width,
const uint32_t height,
const ConversionFlag conversionFlag,
const uint32_t source0PaddingElements,
const uint32_t source1PaddingElements,
const uint32_t source2PaddingElements,
const uint32_t targetPaddingElements,
Worker* worker);
195 template <
typename TSource,
typename TTarget>
196 using ThreeSourcesThreeTargetConversionFunction = void(*)(
const TSource* source0,
const TSource* source1,
const TSource* source2, TTarget* target0, TTarget* target1, TTarget* target2,
const uint32_t width,
const uint32_t height,
const ConversionFlag conversionFlag,
const uint32_t source0PaddingElements,
const uint32_t source1PaddingElements,
const uint32_t source2PaddingElements,
const uint32_t targetPaddingElements0,
const uint32_t targetPaddingElements1,
const uint32_t targetPaddingElements2,
Worker* worker);
201 template <
typename TSource,
typename TTarget>
202 using ThreeSourcesOneTargetAlphaConversionFunction = void(*)(
const TSource* source0,
const TSource* source1,
const TSource* source2, TTarget* target,
const uint32_t width,
const uint32_t height,
const ConversionFlag conversionFlag,
const uint32_t source0PaddingElements,
const uint32_t source1PaddingElements,
const uint32_t source2PaddingElements,
const uint32_t targetPaddingElements,
const TTarget alpha,
Worker* worker);
317 bool invoke(
const Frame& source,
Frame& target,
const FrameConverter::ConversionFlag conversionFlag,
const void* options,
Worker* worker)
const;
361 static bool testFrameConversion(
const FrameType::PixelFormat& sourcePixelFormat,
const FrameType::PixelFormat& targetPixelFormat,
const unsigned int width,
const unsigned int height,
const FunctionWrapper& functionWrapper,
const CV::FrameConverter::ConversionFlag conversionFlag,
const FunctionPixelValue functionSourcePixelValue,
const FunctionPixelValue functionTargetPixelValue,
const MatrixD& transformationMatrix,
const double minimalGroundTruthValue,
const double maximalGroundTruthValue,
const double testDuration,
Worker& worker,
const unsigned int thresholdMaximalErrorToInteger = 3u,
const void* options =
nullptr);
380 static bool validateConversion(
const Frame& sourceFrame,
const Frame& targetFrame,
const FunctionPixelValue functionSourcePixelValue,
const FunctionPixelValue functionTargetPixelValue,
const MatrixD& transformationMatrix,
const CV::FrameConverter::ConversionFlag conversionFlag,
double* averageAbsErrorToFloat,
double* averageAbsErrorToInteger,
double* maximalAbsErrorToFloat,
unsigned int* maximalAbsErrorToInteger,
const double minimalGroundTruthValue,
const double maximalGroundTruthValue,
const bool skipPlausibilityCheck =
false);
394 alphaValue_(uint8_t(
RandomI::random(0u, 255u))),
397 const std::vector<float> gammaValues = {0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f};
This is the base class for all frame converter classes.
Definition: FrameConverter.h:32
ConversionFlag
Definition of individual conversion flags.
Definition: FrameConverter.h:39
This class implements Ocean's image class.
Definition: Frame.h:1792
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition: Frame.h:183
This class implements a matrix with arbitrary size.
Definition: Matrix.h:63
This class provides base random functions and several random functions for integer data types.
Definition: RandomI.h:29
static unsigned int random(const unsigned int maxValue)
Returns one random integer value with specified maximum value.
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
This class is a wrapper for function pointers.
Definition: FrameConverterTestUtilities.h:86
const void * function_
The function pointer of the conversion function.
Definition: FrameConverterTestUtilities.h:322
FunctionWrapper(const TwoSourcesOneTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_1_UINT8 function.
FunctionType
Definition of individual types of conversion functions.
Definition: FrameConverterTestUtilities.h:93
@ FT_2_UINT8_TO_1_UINT8_ALPHA
2-plane uint8 to 1-plane uint8 conversion function.
Definition: FrameConverterTestUtilities.h:119
@ FT_1_UINT8_TO_2_UINT8
1-plane uint8 to 2-plane uint8 conversion function.
Definition: FrameConverterTestUtilities.h:115
@ FT_1_UINT16_TO_1_UINT16
1-plane uint16 to 1-plane uint16 conversion function.
Definition: FrameConverterTestUtilities.h:109
@ FT_1_UINT8_TO_1_UINT8_BLACKLEVEL_WHITEBALANCE_GAMMA
1-plane uint8 to 1-plane uint8 plus constant black level, white balance, and gamma conversion functio...
Definition: FrameConverterTestUtilities.h:105
@ FT_1_UINT8_GAMMA_TO_1_UINT8
1-plane uint8 plus constant gamma to 1-plane uint8 conversion function.
Definition: FrameConverterTestUtilities.h:101
@ FT_1_UINT8_TO_1_UINT16
1-plane uint8 to 1-plane uint16 conversion function.
Definition: FrameConverterTestUtilities.h:99
@ FT_1_UINT8_TO_1_UINT8_ALPHA
1-plane uint8 to 1-plane plus constant alpha uint8 conversion function.
Definition: FrameConverterTestUtilities.h:103
@ FT_1_UINT16_TO_1_UINT8
1-plane uint16 to 1-plane uint8 conversion function.
Definition: FrameConverterTestUtilities.h:107
@ FT_1_UINT32_TO_1_UINT8
1-plane uint32 to 1-plane uint8 conversion function.
Definition: FrameConverterTestUtilities.h:111
@ FT_1_UINT8_TO_1_UINT8
1-plane uint8 to 1-plane uint8 conversion function.
Definition: FrameConverterTestUtilities.h:97
@ FT_3_UINT8_TO_1_UINT8
3-plane uint8 to 1-plane uint8 conversion function.
Definition: FrameConverterTestUtilities.h:125
@ FT_2_UINT8_TO_1_UINT8
2-plane uint8 to 1-plane plus constant alpha uint8 conversion function.
Definition: FrameConverterTestUtilities.h:121
@ FT_2_UINT8_TO_3_UINT8
2-plane uint8 to 3-plane plus constant alpha uint8 conversion function.
Definition: FrameConverterTestUtilities.h:123
@ FT_1_UINT8_TO_3_UINT8
1-plane uint8 to 3-plane uint8 conversion function.
Definition: FrameConverterTestUtilities.h:117
@ FT_1_UINT32_TO_1_UINT16
1-plane uint32 to 1-plane uint16 conversion function.
Definition: FrameConverterTestUtilities.h:113
@ FT_3_UINT8_TO_3_UINT8
3-plane uint8 to 3-plane uint8 conversion function.
Definition: FrameConverterTestUtilities.h:127
void(*)(const TSource *source0, const TSource *source1, const TSource *source2, TTarget *target0, TTarget *target1, TTarget *target2, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t source2PaddingElements, const uint32_t targetPaddingElements0, const uint32_t targetPaddingElements1, const uint32_t targetPaddingElements2, Worker *worker) ThreeSourcesThreeTargetConversionFunction
Definition of a function pointer to a conversion function with three source planes and three target p...
Definition: FrameConverterTestUtilities.h:196
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint32_t, uint16_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT32_TO_1_UINT16 function.
FunctionWrapper(const TwoSourcesThreeTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_3_UINT8 function.
FunctionWrapper(const ThreeSourcesThreeTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_3_UINT8 function.
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8 function.
void(*)(const TSource *source, TTarget *target, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const uint16_t blackLevel, const float *whiteBalance, const float gamma, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, Worker *worker) OneSourceOneTargetBlackLevelWhiteBalanceGammaConversionFunction
Definition of a function pointer to a conversion function with one source plane and one target plane ...
Definition: FrameConverterTestUtilities.h:154
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint16_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT16_TO_1_UINT8 function.
void(*)(const TSource *source, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, const TTarget alpha, Worker *worker) OneSourceOneTargetAlphaConversionFunction
Definition of a function pointer to a conversion function with one source plane and one target plane ...
Definition: FrameConverterTestUtilities.h:148
void(*)(const TSource *source0, const TSource *source1, const TSource *source2, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t source2PaddingElements, const uint32_t targetPaddingElements, const TTarget alpha, Worker *worker) ThreeSourcesOneTargetAlphaConversionFunction
Definition of a function pointer to a conversion function with three source planes and one target pla...
Definition: FrameConverterTestUtilities.h:202
bool invoke(const Frame &source, Frame &target, const FrameConverter::ConversionFlag conversionFlag, const void *options, Worker *worker) const
Calls the conversion function for a source and target frame.
void(*)(const TSource *source, TTarget *target0, TTarget *target1, TTarget *target2, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t target0PaddingElements, const uint32_t target1PaddingElements, const uint32_t target2PaddingElements, Worker *worker) OneSourceThreeTargetsConversionFunction
Definition of a function pointer to a conversion function with one source plane and three target plan...
Definition: FrameConverterTestUtilities.h:166
void(*)(const TSource *source, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, Worker *worker) OneSourceOneTargetConversionFunction
Definition of a function pointer to a conversion function with one source plane and one target plane.
Definition: FrameConverterTestUtilities.h:136
const FunctionType functionType_
The type of the conversion function.
Definition: FrameConverterTestUtilities.h:325
FunctionWrapper(const OneSourceOneTargetBlackLevelWhiteBalanceGammaConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8_BLACKLEVEL_WHIT...
void(*)(const TSource *source, TTarget *target0, TTarget *target1, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t target0PaddingElements, const uint32_t target1PaddingElements, Worker *worker) OneSourceTwoTargetsConversionFunction
Definition of a function pointer to a conversion function with one source plane and two target planes...
Definition: FrameConverterTestUtilities.h:160
void(*)(const TSource *source0, const TSource *source1, TTarget *target0, TTarget *target1, TTarget *target2, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t targetPaddingElements0, const uint32_t targetPaddingElements1, const uint32_t targetPaddingElements2, Worker *worker) TwoSourcesThreeTargetConversionFunction
Definition of a function pointer to a conversion function with two source planes and three target pla...
Definition: FrameConverterTestUtilities.h:178
void(*)(const TSource *source0, const TSource *source1, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t targetPaddingElements, const TTarget alpha, Worker *worker) TwoSourcesOneTargetAlphaConversionFunction
Definition of a function pointer to a conversion function with two source planes and one target plane...
Definition: FrameConverterTestUtilities.h:184
FunctionWrapper(const OneSourceOneTargetAlphaConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8_ALPHA function.
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint16_t, uint16_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT16_TO_1_UINT16 function.
FunctionWrapper(const ThreeSourcesOneTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_1_UINT8 function.
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint8_t, uint16_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT16 function.
FunctionWrapper(const OneSourceTwoTargetsConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_2_UINT8 function.
FunctionWrapper(const OneSourceThreeTargetsConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_3_UINT8 function.
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint32_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT32_TO_1_UINT8 function.
FunctionWrapper(const TwoSourcesOneTargetAlphaConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_1_UINT8_ALPHA function.
FunctionWrapper(const OneSourceGammaOneTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_GAMMA_TO_1_UINT8 function.
void(*)(const TSource *source0, const TSource *source1, const TSource *source2, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t source2PaddingElements, const uint32_t targetPaddingElements, Worker *worker) ThreeSourcesOneTargetConversionFunction
Definition of a function pointer to a conversion function with three source planes and one target pla...
Definition: FrameConverterTestUtilities.h:190
void(*)(const TSource *source0, const TSource *source1, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t targetPaddingElements, Worker *worker) TwoSourcesOneTargetConversionFunction
Definition of a function pointer to a conversion function with two source planes and one target plane...
Definition: FrameConverterTestUtilities.h:172
FunctionWrapper(const ThreeSourcesOneTargetAlphaConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_1_UINT8_ALPHA function.
void(*)(const TSource *source, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const float gamma, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, Worker *worker) OneSourceGammaOneTargetConversionFunction
Definition of a function pointer to a conversion function with one source plane and one target plane ...
Definition: FrameConverterTestUtilities.h:142
This class is a helper class simply offering random values which are constant during process executio...
Definition: FrameConverterTestUtilities.h:49
ValueProvider()
Protected constructor.
Definition: FrameConverterTestUtilities.h:393
uint8_t alphaValue() const
Returns the random (but constant during process execution) alpha value.
Definition: FrameConverterTestUtilities.h:402
float gammaValue() const
Returns the random (but constant during process execution) gamma value.
Definition: FrameConverterTestUtilities.h:407
float gammaValue_
The gamma value.
Definition: FrameConverterTestUtilities.h:79
uint8_t alphaValue_
The alpha value.
Definition: FrameConverterTestUtilities.h:76
This class implements frame converter test utilities.
Definition: FrameConverterTestUtilities.h:42
std::function< MatrixD(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)> FunctionPixelValue
Definition of a function pointer to a pixel extraction function.
Definition: FrameConverterTestUtilities.h:338
static MatrixD functionGenericPixel(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)
Extracts one pixel from a generic frame (e.g,.
static bool testFrameConversion(const FrameType::PixelFormat &sourcePixelFormat, const FrameType::PixelFormat &targetPixelFormat, const unsigned int width, const unsigned int height, const FunctionWrapper &functionWrapper, const CV::FrameConverter::ConversionFlag conversionFlag, const FunctionPixelValue functionSourcePixelValue, const FunctionPixelValue functionTargetPixelValue, const MatrixD &transformationMatrix, const double minimalGroundTruthValue, const double maximalGroundTruthValue, const double testDuration, Worker &worker, const unsigned int thresholdMaximalErrorToInteger=3u, const void *options=nullptr)
Tests the conversion of frames with one pixel format to another pixel format for functions supporting...
static bool validateConversion(const Frame &sourceFrame, const Frame &targetFrame, const FunctionPixelValue functionSourcePixelValue, const FunctionPixelValue functionTargetPixelValue, const MatrixD &transformationMatrix, const CV::FrameConverter::ConversionFlag conversionFlag, double *averageAbsErrorToFloat, double *averageAbsErrorToInteger, double *maximalAbsErrorToFloat, unsigned int *maximalAbsErrorToInteger, const double minimalGroundTruthValue, const double maximalGroundTruthValue, const bool skipPlausibilityCheck=false)
Validates the color space conversion from a source pixel format to a target pixel format.
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
MatrixT< double > MatrixD
Definition of the MatrixT template class using a double precision float data type.
Definition: Matrix.h:32
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15