Package com.irurueta.ar.calibration
Class QRPattern2D
java.lang.Object
com.irurueta.ar.calibration.Pattern2D
com.irurueta.ar.calibration.QRPattern2D
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionprivate doubleQR code height expressed in meters.private doubleQR code width expressed in meters.static final doubleDefault QR code height expressed in meters.static final doubleDefault QR code width expressed in meters.static final intDefault number of horizontal and vertical modules (e.q. squares shown in QR).static final intReturns number of points used by this 2D pattern.static final intOffset of origin expressed in modules so that top-left finder pattern is placed at 0,0.static final intSupported QR code version. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns QR code height expressed in meters.doubleReturns 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.intReturns number of 2D points used by this pattern.getType()Gets pattern type.voidsetCodeHeight(double codeHeight) Sets QR code height expressed in meters.voidsetCodeWidth(double codeWidth) Sets QR code width expressed in meters.
-
Field Details
-
NUMBER_OF_POINTS
public static final int NUMBER_OF_POINTSReturns number of points used by this 2D pattern.- See Also:
-
QR_VERSION
public static final int QR_VERSIONSupported QR code version.- See Also:
-
NUMBER_OF_MODULES
public static final int NUMBER_OF_MODULESDefault 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_OFFSETOffset 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_WIDTHDefault 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_HEIGHTDefault QR code height expressed in meters. This value is used to obtain a reference physical measure.- See Also:
-
codeWidth
private double codeWidthQR code width expressed in meters. This value is used to obtain a reference physical measure. -
codeHeight
private double codeHeightQR 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
Returns ideal points coordinates contained in a QR 2D pattern and expressed in meters. These values are used for calibration purposes- Specified by:
getIdealPointsin classPattern2D- Returns:
- ideal points coordinates.
-
getNumberOfPoints
public int getNumberOfPoints()Returns number of 2D points used by this pattern.- Specified by:
getNumberOfPointsin classPattern2D- Returns:
- number of 2D points used by this pattern.
-
getType
Gets pattern type.
-