8 #ifndef META_OCEAN_CV_FRAME_CONVERTER_THRESHOLD_H
9 #define META_OCEAN_CV_FRAME_CONVERTER_THRESHOLD_H
40 static inline void convertY8ToB8(uint8_t* buffer,
const unsigned int width,
const unsigned int height,
const unsigned int bufferPaddingElements,
const uint8_t threshold,
Worker* worker =
nullptr);
54 static inline void convertY8ToB8(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const uint8_t threshold,
Worker* worker =
nullptr);
78 static inline void convertBorderedY8ToB8(
const uint8_t* source,
const uint32_t* sourceBorderedIntegral, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int sourceBorderedIntegralPaddingElements,
const unsigned int targetPaddingElements,
const unsigned int kernelSize,
const float threshold,
Worker* worker =
nullptr);
115 static uint8_t
calculateOtsuThreshold(
const uint8_t* source,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
Worker* worker =
nullptr);
130 static void convertY8ToB8Subset(uint8_t* buffer,
const unsigned int width,
const unsigned int height,
const unsigned int bufferPaddingElements,
const uint8_t threshold,
const unsigned int firstRow,
const unsigned int numberRows);
145 static void convertY8ToB8Subset(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const uint8_t threshold,
const unsigned int firstRow,
const unsigned int numberRows);
170 static void convertBorderedY8ToB8Subset(
const uint8_t* source,
const uint32_t* sourceBorderedIntegral, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int sourceBorderedIntegralPaddingElements,
const unsigned int targetPaddingElements,
const unsigned int kernelSize,
const float threshold,
const unsigned int firstRow,
const unsigned int numberRows);
175 ocean_assert(buffer !=
nullptr);
176 ocean_assert(width >= 1u && height >= 1u);
177 ocean_assert(threshold >= 1u);
189 inline void FrameConverterThreshold::convertY8ToB8(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const uint8_t threshold,
Worker* worker)
191 ocean_assert(source !=
nullptr && target !=
nullptr);
192 ocean_assert(width >= 1u && height >= 1u);
193 ocean_assert(threshold >= 1u);
197 worker->
executeFunction(
Worker::Function::createStatic(&
FrameConverterThreshold::convertY8ToB8Subset, source, target, width, height, sourcePaddingElements, targetPaddingElements, threshold, 0u, 0u), 0u, height);
201 convertY8ToB8Subset(source, target, width, height, sourcePaddingElements, targetPaddingElements, threshold, 0u, height);
205 inline void FrameConverterThreshold::convertBorderedY8ToB8(
const uint8_t* source,
const uint32_t* sourceBorderedIntegral, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int sourceBorderedIntegralPaddingElements,
const unsigned int targetPaddingElements,
const unsigned int kernelSize,
const float threshold,
Worker* worker)
209 worker->
executeFunction(
Worker::Function::createStatic(&
convertBorderedY8ToB8Subset, source, sourceBorderedIntegral, target, width, height, sourcePaddingElements, sourceBorderedIntegralPaddingElements, targetPaddingElements, kernelSize, threshold, 0u, 0u), 0, height);
213 convertBorderedY8ToB8Subset(source, sourceBorderedIntegral, target, width, height, sourcePaddingElements, sourceBorderedIntegralPaddingElements, targetPaddingElements, kernelSize, threshold, 0u, height);
This is the base class for all frame converter classes.
Definition: FrameConverter.h:32
This class implements frame converters dividing a frame by application of a threshold.
Definition: FrameConverterThreshold.h:27
static void convertY8ToB8(uint8_t *buffer, const unsigned int width, const unsigned int height, const unsigned int bufferPaddingElements, const uint8_t threshold, Worker *worker=nullptr)
Converts an 8 bit (grayscale) frame into a binary frame using a threshold value.
Definition: FrameConverterThreshold.h:173
static void convertBorderedY8ToB8(const uint8_t *source, const uint32_t *sourceBorderedIntegral, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int sourceBorderedIntegralPaddingElements, const unsigned int targetPaddingElements, const unsigned int kernelSize, const float threshold, Worker *worker=nullptr)
Converts a gray scale frame into a second binary frame using a relative threshold and a kernel size.
Definition: FrameConverterThreshold.h:205
static uint8_t calculateOtsuThreshold(const uint8_t *source, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, Worker *worker=nullptr)
Calculate binarization threshold for a given image by application of the Otsu algorithm.
static void convertY8ToB8Subset(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const uint8_t threshold, const unsigned int firstRow, const unsigned int numberRows)
Converts an 8 bit gray scale frame into a second binary frame using a threshold.
static void convertY8ToB8Subset(uint8_t *buffer, const unsigned int width, const unsigned int height, const unsigned int bufferPaddingElements, const uint8_t threshold, const unsigned int firstRow, const unsigned int numberRows)
Converts an 8 bit gray scale frame into a binary frame using a threshold.
static void convertBorderedY8ToB8Subset(const uint8_t *source, const uint32_t *sourceBorderedIntegral, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int sourceBorderedIntegralPaddingElements, const unsigned int targetPaddingElements, const unsigned int kernelSize, const float threshold, const unsigned int firstRow, const unsigned int numberRows)
Converts a gray scale frame into a second binary frame using a relative threshold and a kernel size.
static Caller< void > createStatic(typename StaticFunctionPointerMaker< void, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass >::Type function)
Creates a new caller container for a static function with no function parameter.
Definition: Caller.h:2876
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
bool executeFunction(const Function &function, const unsigned int first, const unsigned int size, const unsigned int firstIndex=(unsigned int)(-1), const unsigned int sizeIndex=(unsigned int)(-1), const unsigned int minimalIterations=1u, const unsigned int threadIndex=(unsigned int)(-1))
Executes a callback function separable by two function parameters.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15