16 #include <type_traits>
42 using FindNextPixelFunc = bool(*)(
const uint8_t*
const,
const unsigned int,
const unsigned int,
const unsigned int,
const unsigned int,
const unsigned int,
CV::Bresenham&,
const unsigned int,
const unsigned int,
unsigned int&,
unsigned int&,
VectorT2<unsigned int>&,
VectorT2<unsigned int>&);
70 template <
bool tFindBlackPixel>
71 static bool findNextPixel(
const uint8_t*
const yPointer,
const unsigned int x,
const unsigned int y,
const unsigned int width,
const unsigned int height,
const unsigned int yPointerPaddingElements,
CV::Bresenham& bresenham,
const unsigned int maximumDistance,
const unsigned int threshold,
unsigned int& columns,
unsigned int& rows,
VectorT2<unsigned int>& lastPointInside,
VectorT2<unsigned int>& firstPointOutside);
85 template <
bool tFindBlackPixel>
86 static bool findNextUpperPixel(
const uint8_t* yPointer,
unsigned int y,
const unsigned int height,
const unsigned int maximalRows,
const unsigned int threshold,
const unsigned int frameStrideElements,
unsigned int& rows);
100 template <
bool tFindBlackPixel>
101 static bool findNextLowerPixel(
const uint8_t* yPointer,
unsigned int y,
const unsigned int height,
const unsigned int maximalRows,
const unsigned int threshold,
const unsigned int frameStrideElements,
unsigned int& rows);
116 static bool determineSubPixelLocation(
const uint8_t* yFrame,
const unsigned int width,
const unsigned int height,
const unsigned int framePaddingElements,
const unsigned int xCenter,
const unsigned int yCenter,
const bool isNormalReflectance,
const unsigned int grayThreshold,
Vector2& location);
140 static inline bool isBlack(
const T& intensityValue,
const T& threshold);
150 static inline bool isWhite(
const T& intensityValue,
const T& threshold);
158 static inline bool isBlackPixel(
const uint8_t* yFramePixel, uint8_t threshold);
166 static inline bool isWhitePixel(
const uint8_t* yFramePixel, uint8_t threshold);
177 static inline bool computeHorizontalTransitionPointSubpixelAccuracy(
const std::uint8_t* yRow,
const unsigned int width,
const unsigned int xPointLeft,
const std::uint8_t grayThreshold,
Scalar& xTransitionPoint);
183 static_assert(std::is_arithmetic_v<T> &&
NumericT<T>::maxValue() >= 255,
"`T` must be an arithmetic type able to hold values up to 255!");
184 ocean_assert (threshold >= T(0) && threshold <= T(255));
186 return intensityValue <= threshold;
192 static_assert(std::is_arithmetic_v<T> &&
NumericT<T>::maxValue() >= 255,
"`T` must be an arithmetic type able to hold values up to 255!");
193 ocean_assert (threshold >= T(0) && threshold <= T(255));
195 return intensityValue > threshold;
200 ocean_assert(yFramePixel !=
nullptr);
202 return isBlack(*yFramePixel, threshold);
207 ocean_assert(yFramePixel !=
nullptr);
209 return isWhite(*yFramePixel, threshold);
214 ocean_assert(yRow !=
nullptr);
215 ocean_assert_and_suppress_unused(xPointLeft <= width - 2u, width);
217 const std::uint8_t leftPixelValue = yRow[xPointLeft];
218 const std::uint8_t rightPixelValue = yRow[xPointLeft + 1u];
220 if (leftPixelValue <= grayThreshold == rightPixelValue <= grayThreshold)
225 xTransitionPoint = xPointLeft +
Scalar((
int)leftPixelValue - (
int)grayThreshold) / ((int)leftPixelValue - (
int)rightPixelValue);
This class implements bresenham line algorithms.
Definition: Bresenham.h:27
Definition of functions related to the detection of pixel transitions.
Definition: TransitionDetector.h:35
static bool computeHorizontalTransitionPointSubpixelAccuracy(const std::uint8_t *yRow, const unsigned int width, const unsigned int xPointLeft, const std::uint8_t grayThreshold, Scalar &xTransitionPoint)
Determines whether a transition occurred between pixel values of two neighboring pixels in a row and,...
Definition: TransitionDetector.h:212
bool(*)(const uint8_t *const, const unsigned int, const unsigned int, const unsigned int, const unsigned int, const unsigned int, CV::Bresenham &, const unsigned int, const unsigned int, unsigned int &, unsigned int &, VectorT2< unsigned int > &, VectorT2< unsigned int > &) FindNextPixelFunc
Function pointer to functions that detect a transition.
Definition: TransitionDetector.h:42
static bool isBlack(const T &intensityValue, const T &threshold)
Determines whether an intensity value is black according to threshold value.
Definition: TransitionDetector.h:181
static bool findNextUpperPixel(const uint8_t *yPointer, unsigned int y, const unsigned int height, const unsigned int maximalRows, const unsigned int threshold, const unsigned int frameStrideElements, unsigned int &rows)
Finds either the next black or the next white pixel towards negative y direction (upwards in an image...
static bool isBlackPixel(const uint8_t *yFramePixel, uint8_t threshold)
Determines whether a pixel is black according to threshold value.
Definition: TransitionDetector.h:198
static bool determineSubPixelLocation(const uint8_t *yFrame, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, const unsigned int xCenter, const unsigned int yCenter, const bool isNormalReflectance, const unsigned int grayThreshold, Vector2 &location)
Determines the sub-pixel location of a fiducial marker given its approximate location.
static bool findNextPixel(const uint8_t *const yPointer, const unsigned int x, const unsigned int y, const unsigned int width, const unsigned int height, const unsigned int yPointerPaddingElements, CV::Bresenham &bresenham, const unsigned int maximumDistance, const unsigned int threshold, unsigned int &columns, unsigned int &rows, VectorT2< unsigned int > &lastPointInside, VectorT2< unsigned int > &firstPointOutside)
Finds a the next dark or the next light pixel in a specified direction.
static bool findNextLowerPixel(const uint8_t *yPointer, unsigned int y, const unsigned int height, const unsigned int maximalRows, const unsigned int threshold, const unsigned int frameStrideElements, unsigned int &rows)
Finds either the next black or the next white pixel towards positive y direction (downwards in an ima...
static bool computeTransitionPointSubpixelAccuracy(const uint8_t *const yFrame, const unsigned int width, const unsigned int height, const unsigned int yFramePaddingElements, const VectorT2< unsigned int > &pointInside, const VectorT2< unsigned int > &pointOutside, const unsigned int grayThreshold, Vector2 &transitionPoint)
Computes the intensity transition point with sub-pixel accuracy given the two image points around a t...
static bool isWhitePixel(const uint8_t *yFramePixel, uint8_t threshold)
Determines whether a pixel is white according to threshold value.
Definition: TransitionDetector.h:205
static bool isWhite(const T &intensityValue, const T &threshold)
Determines whether an intensity value is white according to threshold value.
Definition: TransitionDetector.h:190
bool(*)(const uint8_t *, const uint8_t) PixelBinaryThresholdFunc
Function pointer for applying a binary threshold to a pixel to determine whether it is black or white...
Definition: TransitionDetector.h:48
This class provides basic numeric functionalities.
Definition: Numeric.h:57
This class implements a vector with two elements.
Definition: Vector2.h:96
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< QRCode > QRCodes
Definition of a vector of QR codes.
Definition: QRCode.h:25
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15