8#ifndef OCEAN_CV_DETECTOR_BULLSEYES_BULLSEYEDETECTORMONO_H
9#define OCEAN_CV_DETECTOR_BULLSEYES_BULLSEYEDETECTORMONO_H
182 static
void detectBullseyesSubset(const
Frame* yFrame,
Bullseyes* bullseyes,
Lock* multiThreadLock, const
bool useAdaptiveRowSpacing, const
unsigned int minimumSegmentSize, const
unsigned int pyramidLayer, const
unsigned int firstRow, const
unsigned int numberRows);
205 template <
bool tFindBlackPixel>
206 static
bool findNextUpperPixel(const
Frame& yFrame, const
unsigned int x, const
unsigned int y, const
unsigned int maximalRows, const
unsigned int threshold,
unsigned int& rows);
219 template <
bool tFindBlackPixel>
220 static
bool findNextLowerPixel(const
Frame& yFrame, const
unsigned int x, const
unsigned int y, const
unsigned int maximalRows, const
unsigned int threshold,
unsigned int& rows);
235 static
unsigned int determineThreshold(const uint8_t* yPosition, const
unsigned int segmentSize1, const
unsigned int segmentSize2, const
unsigned int segmentSize3, const
unsigned int segmentSize4, const
unsigned int segmentSize5);
252 static
bool checkBullseyeInColumn(const
Frame& yFrame, const
unsigned int xCenter, const
unsigned int yCenter, const
unsigned int threshold, const
unsigned int blackRingSegmentMin, const
unsigned int blackRingSegmentMax, const
unsigned int whiteRingSegmentMin, const
unsigned int whiteRingSegmentMax, const
unsigned int dotSegmentMin, const
unsigned int dotSegmentMax);
271 static
bool isBlackPixel(const uint8_t* pixel, const uint8_t threshold);
279 static
bool isWhitePixel(const uint8_t* pixel, const uint8_t threshold);
338 static
bool castHalfRay(const uint8_t* yFrameData, const
unsigned int yFrameWidth, const
unsigned int yFrameHeight, const
unsigned int yFrameStrideElements, const
unsigned int xCenter, const
unsigned int yCenter, const
Scalar angle, const
Scalar maxSearchRadius, const uint8_t centerIntensity, const uint8_t grayThreshold,
HalfRay& ray);
353 static
bool checkRadialConsistency(const
Frame& yFrame, const
unsigned int xCenter, const
unsigned int yCenter, const
unsigned int threshold, const
float maxSearchRadius, const
unsigned int numberDiameters, const
Scalar minValidRayFraction, const
Scalar backgroundExtensionFactor, const
Scalar scale =
Scalar(1),
Diameters* diameters =
nullptr);
373 static
bool checkRadialConsistencyPhase1CastRays(const uint8_t* yData, const
unsigned int width, const
unsigned int height, const
unsigned int strideElements, const
unsigned int xCenter, const
unsigned int yCenter, const
unsigned int threshold, const
float maxSearchRadius, const uint8_t centerIntensity, const
unsigned int numberDiameters, const
Scalar minValidRayFraction, const
Scalar scale,
Diameters& diameters);
This class holds the most important parameters for the detector.
Definition BullseyeDetectorMono.h:71
void setFramePyramidLayers(unsigned int framePyramidLayers) noexcept
Sets the number of layers for the frame pyramid.
static Parameters defaultParameters() noexcept
Returns the default parameters for the detector.
bool useAdaptiveRowSpacing_
Determines whether adaptive row spacing is used (true) or every row is scanned (false) during bullsey...
Definition BullseyeDetectorMono.h:151
unsigned int minimumSegmentSize() const noexcept
Returns the minimum segment size for a valid bullseye detection.
void setMinimumSegmentSize(unsigned int minimumSegmentSize) noexcept
Sets the minimum segment size for a valid bullseye detection.
bool isValid() const noexcept
Returns whether the parameters are valid.
unsigned int framePyramidLayers_
The number of layers for the frame pyramid, with range [1, infinity).
Definition BullseyeDetectorMono.h:148
void setFramePyramidPixelThreshold(unsigned int framePyramidPixelThreshold) noexcept
Sets the pixel threshold for frame pyramid creation.
Parameters()=default
Creates a new valid parameter object.
unsigned int minimumSegmentSize_
The minimum segment size in pixels for a valid bullseye detection, with range [1, infinity).
Definition BullseyeDetectorMono.h:154
unsigned int framePyramidLayers() const noexcept
Returns the number of layers for the frame pyramid.
unsigned int framePyramidPixelThreshold_
The pixel threshold for frame pyramid creation, with range [0, infinity).
Definition BullseyeDetectorMono.h:145
bool useAdaptiveRowSpacing() const noexcept
Returns whether adaptive row spacing is enabled during bullseye detection.
void setUseAdaptiveRowSpacing(bool useAdaptiveRowSpacing) noexcept
Sets whether adaptive row spacing should be used during bullseye detection.
unsigned int framePyramidPixelThreshold() const noexcept
Returns the pixel threshold for frame pyramid creation.
Implementation of a monocular detector for the bullseye pattern.
Definition BullseyeDetectorMono.h:36
static bool findNextUpperPixel(const Frame &yFrame, const unsigned int x, const unsigned int y, const unsigned int maximalRows, const unsigned int threshold, unsigned int &rows)
Finds either the next black or the next white pixel towards negative y direction (upwards in an image...
static bool checkBullseyeInColumn(const Frame &yFrame, const unsigned int xCenter, const unsigned int yCenter, const unsigned int threshold, const unsigned int blackRingSegmentMin, const unsigned int blackRingSegmentMax, const unsigned int whiteRingSegmentMin, const unsigned int whiteRingSegmentMax, const unsigned int dotSegmentMin, const unsigned int dotSegmentMax)
Checks whether a column contains a bullseye at a specified location.
static bool checkRadialConsistencyPhase5RingProportionValidation(const unsigned int xCenter, const unsigned int yCenter, const unsigned int numberDiameters, const Diameters &diameters)
Phase 5 of radial consistency check: Ring proportion validation.
static bool isWhitePixel(const uint8_t *pixel, const uint8_t threshold)
Checks if a pixel is white (bright) based on a threshold.
static bool checkRadialConsistency(const Frame &yFrame, const unsigned int xCenter, const unsigned int yCenter, const unsigned int threshold, const float maxSearchRadius, const unsigned int numberDiameters, const Scalar minValidRayFraction, const Scalar backgroundExtensionFactor, const Scalar scale=Scalar(1), Diameters *diameters=nullptr)
Checks radial consistency of a bullseye candidate by casting rays in multiple directions.
static bool checkRadialConsistencyPhase2SymmetryValidation(const unsigned int xCenter, const unsigned int yCenter, const unsigned int numberDiameters, const Scalar minValidRayFraction, const Scalar scale, Diameters &diameters)
Phase 2 of radial consistency check: Symmetry validation.
static bool findNextLowerPixel(const Frame &yFrame, const unsigned int x, const unsigned int y, const unsigned int maximalRows, const unsigned int threshold, unsigned int &rows)
Finds either the next black or the next white pixel towards positive y direction (downwards in an ima...
static void detectBullseyesSubset(const Frame *yFrame, Bullseyes *bullseyes, Lock *multiThreadLock, const bool useAdaptiveRowSpacing, const unsigned int minimumSegmentSize, const unsigned int pyramidLayer, const unsigned int firstRow, const unsigned int numberRows)
Detects bullseyes in a subset of a given 8-bit grayscale image.
static bool detectBullseyes(const Frame &yFrame, Bullseyes &bullseyes, const Parameters ¶meters=Parameters::defaultParameters(), Worker *worker=nullptr)
Detects bullseyes in a given 8-bit grayscale image.
static bool isBlackPixel(const uint8_t *pixel, const uint8_t threshold)
Checks if a pixel is black (dark) based on a threshold.
static bool determineAccurateBullseyeLocation(const Frame &yFrame, const unsigned int xBullseye, const unsigned int yBullseye, const unsigned int threshold, Vector2 &location)
Determines the sub-pixel location of the center dot of a known bullseye.
static unsigned int determineThreshold(const uint8_t *yPosition, const unsigned int segmentSize1, const unsigned int segmentSize2, const unsigned int segmentSize3, const unsigned int segmentSize4, const unsigned int segmentSize5)
Determines the gray threshold separating bright pixels from dark pixels.
static Vector2 computeSubpixelTransition(const VectorT2< unsigned int > &lastPointInside, const VectorT2< unsigned int > &firstPointOutside, uint8_t insideIntensity, uint8_t outsideIntensity, const unsigned int threshold)
Computes the subpixel transition point between two integer pixels using intensity interpolation.
static Vector2 computeTransitionPointOnRay(const VectorT2< unsigned int > &insidePoint, const VectorT2< unsigned int > &outsidePoint, const uint8_t insideIntensity, const uint8_t outsideIntensity, const unsigned int threshold, const Vector2 ¢er, const Vector2 &rayDirection)
Computes the transition point along a ray using direct distance interpolation.
static bool checkRadialConsistencyPhase1CastRays(const uint8_t *yData, const unsigned int width, const unsigned int height, const unsigned int strideElements, const unsigned int xCenter, const unsigned int yCenter, const unsigned int threshold, const float maxSearchRadius, const uint8_t centerIntensity, const unsigned int numberDiameters, const Scalar minValidRayFraction, const Scalar scale, Diameters &diameters)
Phase 1 of radial consistency check: Cast symmetric half-rays.
static bool checkRadialConsistencyPhase4RadialProfileValidation(const unsigned int xCenter, const unsigned int yCenter, const unsigned int numberDiameters, const Diameters &diameters)
Phase 4 of radial consistency check: Radial profile validation.
static Scalar findMin(const Scalars &values)
Finds the minimum value in a vector of scalar values.
static void detectBullseyesInRow(const Frame &yFrame, const unsigned int y, Bullseyes &bullseyes, const unsigned int minimumSegmentSize, const unsigned int pyramidLayer=0u)
Detects bullseyes in a row of a grayscale image.
static Scalar computeMean(const Scalars &values)
Computes the arithmetic mean of a vector of scalar values.
static bool castHalfRay(const uint8_t *yFrameData, const unsigned int yFrameWidth, const unsigned int yFrameHeight, const unsigned int yFrameStrideElements, const unsigned int xCenter, const unsigned int yCenter, const Scalar angle, const Scalar maxSearchRadius, const uint8_t centerIntensity, const uint8_t grayThreshold, HalfRay &ray)
Casts a half-ray from the bullseye center and finds transition points.
static Scalar computeIntensityInterpolationFactor(const uint8_t insideIntensity, const uint8_t outsideIntensity, const unsigned int threshold)
Computes the interpolation factor for a threshold crossing between two intensity values.
static bool checkRadialConsistencyPhase3IntensityValidation(const Frame &yFrame, const unsigned int threshold, const unsigned int numberDiameters, const Scalar backgroundExtensionFactor, const Scalar scale, const unsigned int xCenter, const unsigned int yCenter, Diameters &diameters)
Phase 3 of radial consistency check: Intensity validation.
static Scalar computeStddev(const Scalars &values, const Scalar mean)
Computes the standard deviation of a vector of scalar values.
Structure to hold a single half-ray result from radial consistency checking.
Definition Bullseye.h:35
This class implements Ocean's image class.
Definition Frame.h:1969
This class implements a recursive lock object.
Definition Lock.h:31
This class implements a vector with two elements.
Definition Vector2.h:96
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition Vector2.h:28
std::vector< Scalar > Scalars
Definition of a vector holding Scalar objects.
Definition Math.h:145
float Scalar
Definition of a scalar type.
Definition Math.h:129
Namespace of the bullseye code library.
Definition AssignmentSolver.h:25
std::vector< Bullseye > Bullseyes
Definition of a vector holding bullseyes.
Definition Bullseye.h:245
std::vector< Diameter > Diameters
Definition of a vector holding diameters.
Definition Bullseye.h:124
Namespace of the CV Detector library.
Definition Barcode.h:19
Namespace of the CV library.
Definition Advanced.h:17
The namespace covering the entire Ocean framework.
Definition Accessor.h:15