58 DM_STANDARD = 1u << 0u,
60 DM_EXTRA_BORDER = 1u << 1u,
64 DM_BEST_PERFORMANCE = DM_STANDARD,
66 DM_BEST_DETECTION = DM_STANDARD | DM_EXTRA_BORDER | DM_BLUR
92 inline bool isValid()
const;
206 static bool determineSymbolFormat(
const uint8_t*
const yFrame,
const unsigned int width,
const unsigned int height,
const unsigned int yFramePaddingElements,
const FinderPattern& topLeft,
const FinderPattern& bottomLeft,
const FinderPattern& topRight,
const unsigned int version,
const SquareMatrix3& homography,
QRCode::ErrorCorrectionCapacity& errorCorrectionCapacity,
QRCodeEncoder::MaskingPattern& maskingPattern);
221 static inline bool computeInitialHomography(
const FinderPattern& topLeft,
const FinderPattern& bottomLeft,
const FinderPattern& topRight,
const unsigned int& version,
const unsigned int cornerIndexTopLeft,
const unsigned int cornerIndexBottomLeft,
const unsigned int cornerIndexTopRight,
SquareMatrix3& homography);
241 static bool computeRefinedHomography(
const uint8_t*
const yFrame,
const unsigned int width,
const unsigned int height,
const unsigned int yFramePaddingElements,
const FinderPattern& topLeft,
const FinderPattern& bottomLeft,
const FinderPattern& topRight,
const unsigned int cornerIndexTopLeft,
const unsigned int cornerIndexBottomLeft,
const unsigned int cornerIndexTopRight,
unsigned int& version,
const SquareMatrix3& initialHomography,
SquareMatrix3& homography);
255 static bool extractModules(
const uint8_t*
const yFrame,
const unsigned int width,
const unsigned int height,
const unsigned int yFramePaddingElements,
const unsigned int grayThreshold,
const unsigned int version,
const SquareMatrix3& homography, std::vector<uint8_t>& modules);
259 frame_H_code_(frame_H_code),
260 finderPatterns_(std::move(finderPatterns))
267 return frame_H_code_.isHomography();
272 return frame_H_code_;
277 return finderPatterns_;
284 ocean_assert(
false &&
"Frame must be valid and an 8 bit grayscale image and the pixel origin must be the upper left corner");
293 ocean_assert(version >= 1u && version <= 40u);
318 const Vector2 imagePoints[12] =
321 topLeft.
corners()[(cornerIndexTopLeft + 0u) & 0b0011u],
322 topLeft.
corners()[(cornerIndexTopLeft + 1u) & 0b0011u],
323 topLeft.
corners()[(cornerIndexTopLeft + 2u) & 0b0011u],
324 topLeft.
corners()[(cornerIndexTopLeft + 3u) & 0b0011u],
327 bottomLeft.
corners()[(cornerIndexBottomLeft + 0u) & 0b0011u],
328 bottomLeft.
corners()[(cornerIndexBottomLeft + 1u) & 0b0011u],
329 bottomLeft.
corners()[(cornerIndexBottomLeft + 2u) & 0b0011u],
330 bottomLeft.
corners()[(cornerIndexBottomLeft + 3u) & 0b0011u],
333 topRight.
corners()[(cornerIndexTopRight + 0u) & 0b0011u],
334 topRight.
corners()[(cornerIndexTopRight + 1u) & 0b0011u],
335 topRight.
corners()[(cornerIndexTopRight + 2u) & 0b0011u],
336 topRight.
corners()[(cornerIndexTopRight + 3u) & 0b0011u],
339 const Vector2 qrcodePoints[12] =
374 const Vector2 rectifiedPoints[3] =
Definition of a class for finder patterns of QR codes (squares in the top-left, top-right and bottom-...
Definition: FinderPatternDetector.h:58
const Vector2 * corners() const
Returns a pointer to the four corners of this finder pattern.
Definition: FinderPatternDetector.h:530
bool cornersKnown() const
Returns true if the four corners of this finder pattern are known, otherwise false.
Definition: FinderPatternDetector.h:525
const Vector2 & position() const
Returns the (center) position of the finder pattern.
Definition: FinderPatternDetector.h:495
Definition of an observation of QR code in 2D.
Definition: LegacyQRCodeDetector2D.h:73
Observation()=default
Creates an invalid observation.
bool isValid() const
Returns if the observation is valid.
Definition: LegacyQRCodeDetector2D.h:265
FinderPatternTriplet finderPatterns_
The finder patterns of the QR code, order: top-left, bottom-left, top-right.
Definition: LegacyQRCodeDetector2D.h:112
const FinderPatternTriplet & finderPatterns() const
Returns a pointer to the finder patterns.
Definition: LegacyQRCodeDetector2D.h:275
const SquareMatrix3 & frame_H_code() const
Returns the homography that maps coordinates in the QR code grid to image coordinates.
Definition: LegacyQRCodeDetector2D.h:270
Deprecated: use QRCodeDetector2D instead.
Definition: LegacyQRCodeDetector2D.h:49
static QRCodes detectQRCodes(const uint8_t *const yFrame, const unsigned int width, const unsigned int height, const unsigned int paddingElements=0u, Worker *worker=nullptr, const DetectionMode detectionMode=DM_STANDARD, Observations *observations=nullptr)
Detects QR codes in a given 8 bit grayscale image.
static bool determineOuterMostCorners(const FinderPattern &topLeft, const FinderPattern &bottomLeft, const FinderPattern &topRight, unsigned int &cornerIndexTopLeft, unsigned int &cornerIndexBottomLeft, unsigned int &cornerIndexTopRight)
Determines the three outer corners of a finder pattern triplet in a QR code Given a (valid) triplet o...
static bool detectTimerPatterns(const uint8_t *const yFrame, const unsigned int width, const unsigned int height, const unsigned int yFramePaddingElements, const unsigned int version, const SquareMatrix3 &homography, const FinderPattern &topLeft, const FinderPattern &bottomLeft, const FinderPattern &topRight)
Detects the timer pattern between (1) the top-left and top-right or (2) the top-left and bottom-left ...
static bool determineSymbolFormat(const uint8_t *const yFrame, const unsigned int width, const unsigned int height, const unsigned int yFramePaddingElements, const FinderPattern &topLeft, const FinderPattern &bottomLeft, const FinderPattern &topRight, const unsigned int version, const SquareMatrix3 &homography, QRCode::ErrorCorrectionCapacity &errorCorrectionCapacity, QRCodeEncoder::MaskingPattern &maskingPattern)
Extracts the format information of a QR code from an image given its known location.
static bool extractModules(const uint8_t *const yFrame, const unsigned int width, const unsigned int height, const unsigned int yFramePaddingElements, const unsigned int grayThreshold, const unsigned int version, const SquareMatrix3 &homography, std::vector< uint8_t > &modules)
Read the modules of a QR code with known location (homography) from an image.
static QRCodes detectQRCodes(const Frame &frame, Worker *worker=nullptr, const DetectionMode detectionMode=DM_STANDARD, Observations *observations=nullptr)
Detects QR codes in a given 8 bit grayscale image.
Definition: LegacyQRCodeDetector2D.h:280
static bool computeInitialHomography(const FinderPattern &topLeft, const FinderPattern &bottomLeft, const FinderPattern &topRight, const unsigned int &version, const unsigned int cornerIndexTopLeft, const unsigned int cornerIndexBottomLeft, const unsigned int cornerIndexTopRight, SquareMatrix3 &homography)
Computes an initial transformation to map QR code coordinates to image locations.
Definition: LegacyQRCodeDetector2D.h:291
DetectionMode
Definition of different detection modes.
Definition: LegacyQRCodeDetector2D.h:56
std::vector< Observation > Observations
Definition of a vector of observations.
Definition: LegacyQRCodeDetector2D.h:116
static bool determineSymbolVersionFromImage(const uint8_t *const yFrame, const unsigned int width, const unsigned int height, const unsigned int yFramePaddingElements, const FinderPattern &topLeft, const FinderPattern &bottomLeft, const FinderPattern &topRight, const unsigned int estimatedVersion, const SquareMatrix3 &homography, unsigned int &version)
Extracts the version of a QR code from an image given its known location.
static bool computeRefinedHomography(const uint8_t *const yFrame, const unsigned int width, const unsigned int height, const unsigned int yFramePaddingElements, const FinderPattern &topLeft, const FinderPattern &bottomLeft, const FinderPattern &topRight, const unsigned int cornerIndexTopLeft, const unsigned int cornerIndexBottomLeft, const unsigned int cornerIndexTopRight, unsigned int &version, const SquareMatrix3 &initialHomography, SquareMatrix3 &homography)
Computes the homography for a valid triplet finder patterns and known version of the underlying QR co...
ErrorCorrectionCapacity
Enumeration of the levels of error correction The value of the enums correspond to the standard-defin...
Definition: QRCodeBase.h:53
This class implements common functionality of QR code detectors but is not a stand-alone detector.
Definition: QRCodeDetector.h:33
MaskingPattern
Enum for the mask patterns used to shuffle modules of a QR code.
Definition: QRCodeEncoder.h:45
unsigned int modulesPerSide() const override
Returns the number of modules per side of the QR code.
Definition: QRCode.h:129
This class implements Ocean's image class.
Definition: Frame.h:1792
const T * constdata(const unsigned int planeIndex=0u) const
Returns a pointer to the read-only pixel data of a specific plane.
Definition: Frame.h:4168
bool isValid() const
Returns whether this frame is valid.
Definition: Frame.h:4448
unsigned int paddingElements(const unsigned int planeIndex=0u) const
Returns the optional number of padding elements at the end of each row for a specific plane.
Definition: Frame.h:4042
@ 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:3143
PixelOrigin pixelOrigin() const
Returns the pixel origin of the frame.
Definition: Frame.h:3188
static bool arePixelFormatsCompatible(const PixelFormat pixelFormatA, const PixelFormat pixelFormatB)
Returns whether two given pixel formats are compatible.
PixelFormat pixelFormat() const
Returns the pixel format of the frame.
Definition: Frame.h:3153
@ ORIGIN_UPPER_LEFT
The first pixel lies in the upper left corner, the last pixel in the lower right corner.
Definition: Frame.h:1050
unsigned int height() const
Returns the height of the frame in pixel.
Definition: Frame.h:3148
static bool homographyMatrixLinearWithOptimizations(const Vector2 *leftPoints, const Vector2 *rightPoints, const size_t correspondences, SquareMatrix3 &right_H_left)
Calculates the homography (8DOF - translation, rotation, scale, aspect ratio, shear,...
Definition: Homography.h:452
static bool affineMatrix(const ImagePoint *leftPoints, const ImagePoint *rightPoints, const size_t correspondences, SquareMatrix3 &right_A_left)
Calculates the affine transformation (6DOF - translation, rotation, scale, aspect ratio,...
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
std::array< FinderPattern, 3 > FinderPatternTriplet
Definition of a 3-tuple of finder patterns.
Definition: FinderPatternDetector.h:198
SquareMatrixT3< Scalar > SquareMatrix3
Definition of the SquareMatrix3 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with ...
Definition: SquareMatrix3.h:35
float Scalar
Definition of a scalar type.
Definition: Math.h:128
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition: Vector2.h:21
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