8#ifndef META_OCEAN_CV_CALIBRATION_MARKER_CANDIDATE_H
9#define META_OCEAN_CV_CALIBRATION_MARKER_CANDIDATE_H
54 using NeighborMap = std::unordered_map<CV::PixelDirection, size_t>;
182 inline void addNeighbor(
const CV::PixelDirection neighborDirection,
const size_t neighborMarkerCandidateIndex);
217 inline bool hasNeighbor()
const;
238 inline bool hasMarkerCoordinate()
const;
253 inline bool isValid()
const;
This class implements a candidate of a marker.
Definition MarkerCandidate.h:48
static Indices32 rotateIndicesClockWise90(const Indices32 &indices)
Rotates 25 marker indices clockwise by 90 degree.
bool isValid() const
Returns whether this marker candidate has been initialized with valid border indices.
Definition MarkerCandidate.h:339
bool hasValidBorderIndices() const
Returns whether this marker candidate has 16 valid border point indices.
bool isNeighbor(const MarkerCandidate &markerCandidate, const Points &points, CV::PixelDirection &localEdge, CV::PixelDirection &neighborEdge, const Scalar maxDistancePercentage) const
Returns whether this marker candidate is a neighbor of a given marker candidate.
CV::PixelDirection hasEdge(const Vector2 &predictedCornerA, const Vector2 &predictedCornerB, const Points &points, const Scalar maxSqrDistanceA, const Scalar maxSqrDistanceB) const
Returns whether this marker candidate has an edge which is close to a predicted edge.
Vector2 center(const Points &points) const
Returns the center position of this marker candidate.
MarkerCandidate()=default
Creates an invalid marker candidate.
bool hasValidIndices() const
Returns whether this marker candidate has 25 valid point indices.
bool hasNeighbor() const
Returns whether this marker candidate has at least one known neighbor candidate marker.
Definition MarkerCandidate.h:329
static Indices32 rotateIndices180(const Indices32 &indices)
Rotates the 25 marker indices by 180 degree.
void setMarkerCoordinate(const CV::PixelPosition &markerCoordinate)
Sets the coordinate of the marker.
Definition MarkerCandidate.h:304
void rotateClockWise(const int degree)
Rotates this marker candidate by a multiple of 90 degree.
void setPointIndex(const size_t indexInMarker, const Index32 pointIndex)
Sets the index of a point of the marker.
MarkerCandidate(const Indices32 &borderIndices, const Points &points)
Creates a new marker candidate object with indices of the 16 border points of the marker.
const CV::PixelPosition & markerCoordinate() const
Returns the position of this marker within a calibration board.
Definition MarkerCandidate.h:310
static Indices32 rotateIndicesCounterClockWise90(const Indices32 &indices)
Rotates 25 marker indices counter-clockwise by 90 degree.
void addNeighbor(const CV::PixelDirection neighborDirection, const size_t neighborMarkerCandidateIndex)
Adds a marker candidate as neighbor to this marker candidate.
Definition MarkerCandidate.h:316
std::unordered_map< CV::PixelDirection, size_t > NeighborMap
Definition of an unordered map mapping pixel directions to marker candidate indices.
Definition MarkerCandidate.h:54
bool hasMarkerCoordinate() const
Returns whether this marker candidate has a known marker coordinate.
Definition MarkerCandidate.h:334
const NeighborMap & neighbors() const
Returns the known neighbors of this marker candidate.
Definition MarkerCandidate.h:324
NeighborMap neighborMap_
The map mapping the four neighbor directions to other marker candidates.
Definition MarkerCandidate.h:298
static Indices32 borderIndicesToMarkerIndices(const Indices32 &borderIndices, const bool clockWise)
Returns the 25 marker indices for given 16 border indices.
Index32 pointIndex(const size_t indexInMarker) const
Returns the index of a point of the marker.
static void removeMarkerCandidate(MarkerCandidates &markerCandidates, const size_t index)
Removes a marker candidate from a vector of marker candidates.
MarkerCandidate rotatedClockWise(const int degree) const
Returns the marker candidate rotated by a multiple of 90 degree.
Index32 borderIndex(const size_t indexInBorder) const
Returns the index of a point in the border of the marker.
bool hasNeighborWithMarkerId(const MarkerCandidates &markerCandidates) const
Returns whether this marker candidate has at least one known neighbor with a known valid marker id.
bool determineMarkerId(const Points &points)
Determines the id of the marker candidate.
CV::PixelDirection neighborDirection(const size_t markerCandidateIndex) const
Returns whether a specific marker candidate is a known neighbor of this marker candidate.
CV::PixelPosition markerCoordinate_
The coordinate of the marker, invalid if unknown.
Definition MarkerCandidate.h:301
Indices32 pointIndices_
The 25 indices of the points of the marker, empty if invalid.
Definition MarkerCandidate.h:295
This class implements the base class for a marker in a calibration board.
Definition Marker.h:27
bool isValid() const
Returns whether this pixel position object holds two valid parameters.
std::vector< Index32 > Indices32
Definition of a vector holding 32 bit index values.
Definition Base.h:96
uint32_t Index32
Definition of a 32 bit index value.
Definition Base.h:84
PixelDirection
Definition of individual directions with pixel accuracy.
Definition CV.h:85
@ PD_WEST
Definition CV.h:93
@ PD_EAST
Definition CV.h:101
@ PD_SOUTH
Definition CV.h:97
@ PD_NORTH
Definition CV.h:89
std::vector< Point > Points
Definition of a vector holding points.
Definition cv/calibration/Point.h:31
std::vector< MarkerCandidate > MarkerCandidates
Definition of a vector holding marker candidates.
Definition MarkerCandidate.h:33
float Scalar
Definition of a scalar type.
Definition Math.h:129
The namespace covering the entire Ocean framework.
Definition Accessor.h:15