Class QRPattern2D

java.lang.Object
com.irurueta.ar.calibration.Pattern2D
com.irurueta.ar.calibration.QRPattern2D
All Implemented Interfaces:
Serializable

public class QRPattern2D extends Pattern2D implements Serializable
Contains coordinates of ideal points for a QR code pattern version 2. When physical size of a 2D QR code is known, its corner markets can be used for camera calibration purposes. This pattern takes into account that a QR code has 3 finder patterns and 1 alignment pattern. The points returned by this pattern indicates where should these points be placed for a QR code having provided size. Points are returned in the following order: - Bottom-left finder pattern. - Top-left finder pattern (located at origin of coordinates 0,0). - Top-right finder pattern. - Bottom-right alignment pattern.

The contents of this class are based on: http://www.thonky.com/qr-code-tutorial/module-placement-matrix/

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private double
    QR code height expressed in meters.
    private double
    QR code width expressed in meters.
    static final double
    Default QR code height expressed in meters.
    static final double
    Default QR code width expressed in meters.
    static final int
    Default number of horizontal and vertical modules (e.q. squares shown in QR).
    static final int
    Returns number of points used by this 2D pattern.
    static final int
    Offset of origin expressed in modules so that top-left finder pattern is placed at 0,0.
    static final int
    Supported QR code version.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns QR code height expressed in meters.
    double
    Returns QR code width expressed in meters.
    List<com.irurueta.geometry.Point2D>
    Returns ideal points coordinates contained in a QR 2D pattern and expressed in meters.
    int
    Returns number of 2D points used by this pattern.
    Gets pattern type.
    void
    setCodeHeight(double codeHeight)
    Sets QR code height expressed in meters.
    void
    setCodeWidth(double codeWidth)
    Sets QR code width expressed in meters.

    Methods inherited from class com.irurueta.ar.calibration.Pattern2D

    create

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NUMBER_OF_POINTS

      public static final int NUMBER_OF_POINTS
      Returns number of points used by this 2D pattern.
      See Also:
    • QR_VERSION

      public static final int QR_VERSION
      Supported QR code version.
      See Also:
    • NUMBER_OF_MODULES

      public static final int NUMBER_OF_MODULES
      Default number of horizontal and vertical modules (e.q. squares shown in QR). This follows expression: ((QR_VERSION - 1) * 4) + 21
      See Also:
    • ORIGIN_OFFSET

      public static final int ORIGIN_OFFSET
      Offset of origin expressed in modules so that top-left finder pattern is placed at 0,0.
      See Also:
    • DEFAULT_QR_CODE_WIDTH

      public static final double DEFAULT_QR_CODE_WIDTH
      Default QR code width expressed in meters. This value is used to obtain a reference physical measure.
      See Also:
    • DEFAULT_QR_CODE_HEIGHT

      public static final double DEFAULT_QR_CODE_HEIGHT
      Default QR code height expressed in meters. This value is used to obtain a reference physical measure.
      See Also:
    • codeWidth

      private double codeWidth
      QR code width expressed in meters. This value is used to obtain a reference physical measure.
    • codeHeight

      private double codeHeight
      QR code height expressed in meters. This value is used to obtain a reference physical measure.
  • Constructor Details

    • QRPattern2D

      public QRPattern2D()
      Constructor.
  • Method Details

    • getCodeWidth

      public double getCodeWidth()
      Returns QR code width expressed in meters. This value is used to obtain a reference physical measure.
      Returns:
      QR code width expressed in meters.
    • setCodeWidth

      public void setCodeWidth(double codeWidth)
      Sets QR code width expressed in meters. This value is used to obtain a reference physical measure.
      Parameters:
      codeWidth - QR code width expressed in meters.
      Throws:
      IllegalArgumentException - if provided value is zero or negative.
    • getCodeHeight

      public double getCodeHeight()
      Returns QR code height expressed in meters. This value is used to obtain a reference physical measure.
      Returns:
      QR code height expressed in meters.
    • setCodeHeight

      public void setCodeHeight(double codeHeight)
      Sets QR code height expressed in meters. This value is used to obtain a reference physical measure.
      Parameters:
      codeHeight - QR code width expressed in meters.
      Throws:
      IllegalArgumentException - if provided value is zero or negative.
    • getIdealPoints

      public List<com.irurueta.geometry.Point2D> getIdealPoints()
      Returns ideal points coordinates contained in a QR 2D pattern and expressed in meters. These values are used for calibration purposes
      Specified by:
      getIdealPoints in class Pattern2D
      Returns:
      ideal points coordinates.
    • getNumberOfPoints

      public int getNumberOfPoints()
      Returns number of 2D points used by this pattern.
      Specified by:
      getNumberOfPoints in class Pattern2D
      Returns:
      number of 2D points used by this pattern.
    • getType

      public Pattern2DType getType()
      Gets pattern type.
      Specified by:
      getType in class Pattern2D
      Returns:
      pattern type.