8#ifndef META_OCEAN_TEST_TESTCV_TEST_NON_MAXIMUM_SUPPRESSION_H
9#define META_OCEAN_TEST_TESTCV_TEST_NON_MAXIMUM_SUPPRESSION_H
76 static bool testSuppressionInFrame(
const unsigned int width,
const unsigned int height,
const unsigned int subFrameWidth,
const unsigned int subFrameHeight,
const bool strictMaximum,
const double testDuration,
Worker& worker);
103 template <
typename TCoordinate,
typename TStrength>
111 template <
typename T>
119 template <
typename T>
127 template <
typename T>
135 template <
typename T>
167 static inline StrengthPositions determineFeaturePoints(
const Frame& yFrame,
const unsigned int subRegionLeft,
const unsigned int subRegionTop,
const unsigned int subRegionWidth,
const unsigned int subRegionHeight,
const uint8_t minimalThreshold,
const bool strictMaximum,
Worker* worker =
nullptr);
181 static void determineFeaturePointsSubset(
const Frame* yFrame,
const uint8_t minimalThreshold,
const bool strictMaximum,
Lock* lock,
StrengthPositions* locations,
const unsigned int firstColumn,
const unsigned int numberColumns,
const unsigned int firstRow,
const unsigned int numberRows);
196 template <
typename T>
197 static Frame createGaussianFrame(
const unsigned int frameWidth,
const unsigned int frameHeight,
const T centerX,
const T centerY,
const T sigma,
const bool darkBlob);
211 ocean_assert(subRegionLeft + subRegionWidth <= yFrame.
width() && subRegionTop + subRegionHeight <= yFrame.
height());
213 const unsigned int firstColumn = std::max(1u, subRegionLeft);
214 const unsigned int firstRow = std::max(1u, subRegionTop);
216 const unsigned int endColumn = std::min(subRegionLeft + subRegionWidth, yFrame.
width() - 1u);
217 const unsigned int endRow = std::min(subRegionTop + subRegionHeight, yFrame.
height() - 1u);
219 const unsigned int numberColumns = endColumn - firstColumn;
220 const unsigned int numberRows = endRow - firstRow;
227 worker->
executeFunction(
Worker::Function::createStatic(&
determineFeaturePointsSubset, &yFrame, minimalThreshold, strictMaximum, &lock, &result, firstColumn, numberColumns, 0u, 0u), firstRow, numberRows);
231 determineFeaturePointsSubset(&yFrame, minimalThreshold, strictMaximum,
nullptr, &result, firstColumn, numberColumns, firstRow, numberRows);
239 return a.second < b.second || (a.second == b.second && a.first < b.first);
This class extends a 2D position by a third parameter storing a strength value.
Definition NonMaximumSuppression.h:76
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:2877
This class implements Ocean's image class.
Definition Frame.h:1879
bool isValid() const
Returns whether this frame is valid.
Definition Frame.h:4612
@ FORMAT_Y8
Pixel format for grayscale images with byte order Y and 8 bits per pixel.
Definition Frame.h:594
unsigned int width() const
Returns the width of the frame format in pixel.
Definition Frame.h:3241
PixelFormat pixelFormat() const
Returns the pixel format of the frame.
Definition Frame.h:3251
unsigned int height() const
Returns the height of the frame in pixel.
Definition Frame.h:3246
This class implements a recursive lock object.
Definition Lock.h:31
This class tests the implementation of the NonMaximumSuppression class.
Definition TestNonMaximumSuppression.h:34
static bool testDeterminePrecisePeakLocationIterativeNxN()
Tests the iterative precise peak location function.
static bool testSuppressionInFrame(const unsigned int width, const unsigned int height, const unsigned int subFrameWidth, const unsigned int subFrameHeight, const bool strictMaximum, const double testDuration, Worker &worker)
Tests the non maximum suppression within a frame.
std::vector< StrengthPosition > StrengthPositions
Definition of a vector holding locations.
Definition TestNonMaximumSuppression.h:45
static void determineFeaturePointsSubset(const Frame *yFrame, const uint8_t minimalThreshold, const bool strictMaximum, Lock *lock, StrengthPositions *locations, const unsigned int firstColumn, const unsigned int numberColumns, const unsigned int firstRow, const unsigned int numberRows)
Determines the locations of the extrema by a standard implementation.
static bool comparePositionYX(const IndexPair32 &a, const IndexPair32 &b)
Compares two IndexPair32 positions by y-coordinate first, then by x-coordinate.
Definition TestNonMaximumSuppression.h:237
std::set< StrengthPosition > StrengthPositionSet
Definition of a set holding locations.
Definition TestNonMaximumSuppression.h:50
static bool testSuppressionInStrengthPositions(const double testDuration)
Tests the non maximum suppression within a dataset of strength positions.
static bool testSuppressionInFrameMinimum(const unsigned int width, const unsigned int height, const bool strictMaximum, const double testDuration, Worker &worker)
Tests the non minimum suppression within a frame (finding local minima).
static bool testDeterminePrecisePeakLocation1()
Tests the 1D precise peak location function.
static bool test(const unsigned int width, const unsigned int height, const double testDuration, Worker &worker, const TestSelector &selector=TestSelector())
Tests the entire functionality.
static StrengthPositions determineFeaturePoints(const Frame &yFrame, const unsigned int subRegionLeft, const unsigned int subRegionTop, const unsigned int subRegionWidth, const unsigned int subRegionHeight, const uint8_t minimalThreshold, const bool strictMaximum, Worker *worker=nullptr)
Determines the locations of the extrema by a standard implementation.
Definition TestNonMaximumSuppression.h:208
static Frame createGaussianFrame(const unsigned int frameWidth, const unsigned int frameHeight, const T centerX, const T centerY, const T sigma, const bool darkBlob)
Creates a Y8 frame containing a Gaussian blob at a sub-pixel position.
static void createFeaturePoints(Frame &yFrame, const unsigned int features, const uint8_t featurePointStrength=255u)
Creates a test frame with artificial feature points.
static bool testSuppressionInStrengthPositions(const double testDuration)
Tests the non maximum suppression within a dataset of strength positions.
static bool testDeterminePrecisePeakLocation2()
Tests the 2D precise peak location function.
static bool testDeterminePrecisePeakLocationNxN()
Tests the determinePrecisePeakLocationNxN function.
static bool testCandidate(const double testDuration)
Tests the candidate lookup function.
This class implements a test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
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::pair< Index32, Index32 > IndexPair32
Definition of a pair holding 32 bit indices.
Definition Base.h:138
The namespace covering the entire Ocean framework.
Definition Accessor.h:15