8 #ifndef META_OCEAN_CV_FRAME_FILTER_CANNY_H
9 #define META_OCEAN_CV_FRAME_FILTER_CANNY_H
77 static void filterCannySobelNormalized(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const int8_t lowThreshold = 20,
const int8_t highThreshold = 50,
Worker* worker =
nullptr);
93 static void filterCannySobel(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const int16_t lowThreshold = 160,
const int16_t highThreshold = 400,
Worker* worker =
nullptr);
109 static void filterCannyScharrNormalized(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const int8_t lowThreshold = 20,
const int8_t highThreshold = 50,
Worker* worker =
nullptr);
125 static void filterCannyScharr(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const int16_t lowThreshold = 640,
const int16_t highThreshold = 1600,
Worker* worker =
nullptr);
144 template <
typename TFilterOutputElementType, EdgeFilter tEdgeFilter>
145 static void filterCanny(
const uint8_t* source, uint8_t* target,
const unsigned int width,
const unsigned int height,
const unsigned int sourcePaddingElements,
const unsigned int targetPaddingElements,
const TFilterOutputElementType lowThreshold,
const TFilterOutputElementType highThreshold,
Worker* worker =
nullptr);
158 template <
typename T>
159 static inline void extractGradientDirectionsAndMagnitudes(
const T* egdeFilterResults, uint8_t* direction, T* magnitude,
const T lowThreshold,
const unsigned int width,
const unsigned int height,
Worker* worker =
nullptr);
173 template <
typename T>
174 static void extractGradientDirectionsAndMagnitudesSubset(
const T* egdeFilterResults, uint8_t* direction, T* magnitude,
const T lowThreshold,
const unsigned int width,
const unsigned int height,
const unsigned int firstRow,
const unsigned int numberRows);
188 template <
typename TFilterOutputElementType>
189 static void extractEdgePixels(
const uint8_t*
const gradientDirections,
const TFilterOutputElementType*
const gradientMagnitudes, uint8_t*
const target,
const unsigned int width,
const unsigned int height,
const unsigned int targetPaddingElements,
const TFilterOutputElementType lowThreshold,
const TFilterOutputElementType highThreshold,
Worker* worker =
nullptr);
207 template <
typename TFilterOutputElementType>
208 static void extractEdgePixelsSubset(
const uint8_t*
const gradientDirections,
const TFilterOutputElementType*
const gradientMagnitudes, uint8_t*
const target, uint8_t*
const edgeCandidateMap,
CV::PixelPositions* edgeCandidateStack,
Lock* edgeCandidateStackLock,
const unsigned int width,
const unsigned int height,
const unsigned int targetPaddingElements,
const TFilterOutputElementType lowThreshold,
const TFilterOutputElementType highThreshold,
const unsigned int firstRow,
const unsigned numberRows);
211 template <
typename T>
216 worker->
executeFunction(
Worker::Function::createStatic(&
extractGradientDirectionsAndMagnitudesSubset, egdeFilterResults, direction, magnitude, lowThreshold, width, height, 0u, 0u), 0, height, 6u, 7u, 20u);
This class implements a canny edge filter based on Sobel or Scharr filter operators and their respons...
Definition: FrameFilterCanny.h:28
static void filterCannyScharrNormalized(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const int8_t lowThreshold=20, const int8_t highThreshold=50, Worker *worker=nullptr)
Canny edge detector for 8 bit grayscale images using a normalized Scharr operator Applies a normaliz...
static void extractEdgePixelsSubset(const uint8_t *const gradientDirections, const TFilterOutputElementType *const gradientMagnitudes, uint8_t *const target, uint8_t *const edgeCandidateMap, CV::PixelPositions *edgeCandidateStack, Lock *edgeCandidateStackLock, const unsigned int width, const unsigned int height, const unsigned int targetPaddingElements, const TFilterOutputElementType lowThreshold, const TFilterOutputElementType highThreshold, const unsigned int firstRow, const unsigned numberRows)
Helper function to extract edges from the gradient magnitudes and directions.
static void extractGradientDirectionsAndMagnitudes(const T *egdeFilterResults, uint8_t *direction, T *magnitude, const T lowThreshold, const unsigned int width, const unsigned int height, Worker *worker=nullptr)
Calculates edge directions (quantized to 0, 90, 45, and 135 degrees) and their corresponding magnitue...
Definition: FrameFilterCanny.h:212
static void filterCannySobelNormalized(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const int8_t lowThreshold=20, const int8_t highThreshold=50, Worker *worker=nullptr)
Canny edge detector for 8 bit grayscale images using a normalized Sobel operator Applies a normalize...
static void filterCannyScharr(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const int16_t lowThreshold=640, const int16_t highThreshold=1600, Worker *worker=nullptr)
Canny edge detector for 8 bit grayscale images using a Scharr operator Applies an (unnormalized) Sch...
static void filterCannySobel(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const int16_t lowThreshold=160, const int16_t highThreshold=400, Worker *worker=nullptr)
Canny edge detector for 8 bit grayscale images using a Sobel operator Applies an (unnormalized) Sobe...
static void extractEdgePixels(const uint8_t *const gradientDirections, const TFilterOutputElementType *const gradientMagnitudes, uint8_t *const target, const unsigned int width, const unsigned int height, const unsigned int targetPaddingElements, const TFilterOutputElementType lowThreshold, const TFilterOutputElementType highThreshold, Worker *worker=nullptr)
Extract edges from the gradient magnitudes and directions.
EdgeDirection
Definition of individual edge directions.
Definition: FrameFilterCanny.h:46
@ ED_HORIZONTAL
Horizontal edge with 0 degree.
Definition: FrameFilterCanny.h:50
@ ED_DIAGONAL_45
Diagonal edge with 45 degree.
Definition: FrameFilterCanny.h:52
@ ED_VERTICAL
Vertical edge with 90 degree.
Definition: FrameFilterCanny.h:54
@ ED_DIAGONAL_135
Diagonal edige with 135 degree.
Definition: FrameFilterCanny.h:56
static void extractGradientDirectionsAndMagnitudesSubset(const T *egdeFilterResults, uint8_t *direction, T *magnitude, const T lowThreshold, const unsigned int width, const unsigned int height, const unsigned int firstRow, const unsigned int numberRows)
Calculates a subset of edge directions (quantized to 0, 90, 45, and 135 degrees) and their correspond...
static void filterCanny(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const TFilterOutputElementType lowThreshold, const TFilterOutputElementType highThreshold, Worker *worker=nullptr)
Canny edge filter for 8 bit gray scale images for 0, 90, 45, and 135 degrees.
EdgeFilter
Definition of individual edge filter operators.
Definition: FrameFilterCanny.h:35
@ EF_SOBEL
Sobel operator.
Definition: FrameFilterCanny.h:37
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 recursive lock object.
Definition: Lock.h:31
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.
std::vector< PixelPosition > PixelPositions
Definition of a vector holding pixel positions (with positive coordinate values).
Definition: PixelPosition.h:48
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15