8 #ifndef META_OCEAN_CV_DETECTOR_CALIBRATION_PATTERN_DETECTOR_H
9 #define META_OCEAN_CV_DETECTOR_CALIBRATION_PATTERN_DETECTOR_H
71 inline TrackingThresholds(
const unsigned int width,
const unsigned int height,
const unsigned int harrisCorners,
const Scalar maximalDistance);
77 inline unsigned int harrisCornerThreshold()
const;
85 inline Scalar maximalCornerDistance(
const unsigned int width,
const unsigned int height)
const;
115 inline DetectionThresholds(
const unsigned int width,
const unsigned int height,
const unsigned int harrisCorners,
const Scalar maximalDistance,
const Scalar maximalParallelAngle,
const Scalar orientationError);
121 inline Scalar maximalParallelAngle()
const;
127 inline Scalar orientationError()
const;
153 inline unsigned int horizontalBoxes()
const;
159 inline unsigned int verticalBoxes()
const;
167 inline unsigned int horizontalEdges()
const;
175 inline unsigned int verticalEdges()
const;
182 inline const Pattern& pattern()
const;
201 inline bool isValid()
const;
255 unsigned int horizontalBoxes_ = 0u;
258 unsigned int verticalBoxes_ = 0u;
261 unsigned int horizontalEdges_ = 0u;
264 unsigned int verticalEdges_ = 0u;
270 unsigned int trackingThresholdIndex_ = 0u;
273 unsigned int detectionThresholdIndex_ = 0u;
278 harrisCornerThreshold_(harrisCorner),
279 maximalCornerDistance_(maximalDistance)
281 ocean_assert(width != 0u && height != 0u);
286 return harrisCornerThreshold_;
291 ocean_assert(width != 0u && height != 0u);
296 return maximalCornerDistance_ * currentDiagonal * invFrameDiagonal_;
301 maximalParallelAngle_(maximalParallelAngle),
302 orientationError_(orientationError)
310 ocean_assert(maximalParallelAngle_ >= 0 && maximalParallelAngle_ <
Numeric::pi_2());
311 return maximalParallelAngle_;
316 ocean_assert(orientationError_ >= 0 && orientationError_ <
Numeric::pi_2());
317 return orientationError_;
Definition of a threshold container for detection parameters.
Definition: CalibrationPatternDetector.h:103
Scalar orientationError() const
The expected orientation error each provided line can have e.g., due to measurement/detection inaccur...
Definition: CalibrationPatternDetector.h:314
DetectionThresholds(const unsigned int width, const unsigned int height, const unsigned int harrisCorners, const Scalar maximalDistance, const Scalar maximalParallelAngle, const Scalar orientationError)
Creates a new threshold object.
Definition: CalibrationPatternDetector.h:299
Scalar maximalParallelAngle() const
Returns the maximal angle between two lines so that they still count as parallel.
Definition: CalibrationPatternDetector.h:308
const Scalar orientationError_
The expected orientation error each provided line can have e.g., due to measurement/detection inaccur...
Definition: CalibrationPatternDetector.h:135
const Scalar maximalParallelAngle_
Maximal angle between two lines so that they still count as parallel in radian, with range [0,...
Definition: CalibrationPatternDetector.h:132
Definition of a threshold container for tracking parameters.
Definition: CalibrationPatternDetector.h:61
TrackingThresholds(const unsigned int width, const unsigned int height, const unsigned int harrisCorners, const Scalar maximalDistance)
Creates a new threshold object.
Definition: CalibrationPatternDetector.h:276
Scalar maximalCornerDistance(const unsigned int width, const unsigned int height) const
Returns the maximal distance between predicted and real corner, in pixel.
Definition: CalibrationPatternDetector.h:289
const unsigned int harrisCornerThreshold_
Strength threshold for Harris corners.
Definition: CalibrationPatternDetector.h:93
const Scalar maximalCornerDistance_
Maximal pixel distance between predicted and real corner.
Definition: CalibrationPatternDetector.h:96
const Scalar invFrameDiagonal_
The inverted diagonal distance between two opposite corners inside the camera frame.
Definition: CalibrationPatternDetector.h:90
unsigned int harrisCornerThreshold() const
Returns the strength threshold of the Harris corner.
Definition: CalibrationPatternDetector.h:284
This class implements a detector for calibration patterns.
Definition: CalibrationPatternDetector.h:37
CalibrationPatternDetector(const unsigned int horizontalBoxes, const unsigned int verticalBoxes)
Creates a new calibration pattern detector object.
bool detectCalibrationPatternWithoutKnowledge(const Frame &yFrame, const Timestamp timestamp, Worker *worker)
Detects the calibration pattern without any previous information.
unsigned int horizontalEdges() const
Returns the number of horizontal edges.
Definition: CalibrationPatternDetector.h:330
bool isValid() const
Returns whether the detector holds valid parameters.
Definition: CalibrationPatternDetector.h:340
bool detectCalibrationPatternWithPreviousCorners(const HarrisCorners &harrisCorners, const Scalar maxCornerDistance, const Timestamp timestamp)
Re-detects the calibration pattern using the calibration corners form the previous frame.
unsigned int horizontalBoxes_
Number of horizontal boxes.
Definition: CalibrationPatternDetector.h:255
unsigned int verticalEdges() const
Returns the number of vertical edges.
Definition: CalibrationPatternDetector.h:335
Pattern pattern_
Holds the most recent pattern rows.
Definition: CalibrationPatternDetector.h:267
std::vector< Vector2 > PatternRow
Definition of a (row) vector holding 2D positions.
Definition: CalibrationPatternDetector.h:43
unsigned int verticalBoxes_
Number of vertical boxes.
Definition: CalibrationPatternDetector.h:258
static void sortLinesAccordingDistance(Lines2 &lines, const Vector2 &point=Vector2(0, 0))
Sorts lines regarding to the signed distance to a given point.
std::vector< PatternRow > PatternRows
Definition of a vector holding rows.
Definition: CalibrationPatternDetector.h:48
Geometry::CameraCalibration::Pattern Pattern
Redefinition of a calibration pattern.
Definition: CalibrationPatternDetector.h:53
unsigned int horizontalEdges_
Number of horizontal edges.
Definition: CalibrationPatternDetector.h:261
void release()
Releases the information of the previously found calibration pattern.
bool detectCalibrationPatternWithPreviousCorners(const Frame &yFrame, const Timestamp timestamp, Worker *worker)
Re-detects the calibration pattern using the calibration corners form the previous frame.
unsigned int verticalBoxes() const
Returns the number of vertical boxes.
Definition: CalibrationPatternDetector.h:325
bool detectPattern(const Frame &frame, Worker *worker=nullptr)
Detects the calibration pattern in a new image frame.
unsigned int verticalEdges_
Number of vertical edges.
Definition: CalibrationPatternDetector.h:264
unsigned int horizontalBoxes() const
Returns the number of horizontal boxes.
Definition: CalibrationPatternDetector.h:320
const Pattern & pattern() const
Returns the most recent pattern information (corners of the calibration pattern) associated with the ...
Definition: CalibrationPatternDetector.h:345
bool detectCalibrationPatternWithoutKnowledge(const Frame &yFrame, const HarrisCorners &harrisCorners, const Scalar maxCornerDistance, const Scalar maxParallelAngle, const Scalar orientationError, const Timestamp timestamp, Worker *worker)
Detects the calibration pattern without any previous information.
This class implements Ocean's image class.
Definition: Frame.h:1792
Definition of a class holding the information about one calibration pattern.
Definition: CameraCalibration.h:41
This class provides basic numeric functionalities.
Definition: Numeric.h:57
static constexpr T pi_2()
Returns PI/2 which is equivalent to 90 degree.
Definition: Numeric.h:938
static constexpr bool isNotEqualEps(const T value)
Returns whether a value is not smaller than or equal to a small epsilon.
Definition: Numeric.h:2237
This class implements a timestamp.
Definition: Timestamp.h:36
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
std::vector< HarrisCorner > HarrisCorners
Definition of a vector holding Harris corners.
Definition: HarrisCorner.h:24
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< Line2 > Lines2
Definition of a vector holding Line2 objects.
Definition: Line2.h:57
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition: Vector2.h:21
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15