Class QrCodeEncoder

java.lang.Object
boofcv.alg.fiducial.qrcode.QrCodeEncoder

public class QrCodeEncoder extends Object
Provides an easy to use interface for specifying QR-Code parameters and generating the raw data sequence. After the QR Code has been created using this class it can then be rendered. By default it will select the qr code version based on the number of bits and the error correction level based on the version and number of bits. If the error correction isn't specified and the version isn't specified then error correction level M is used by default.
  • Constructor Details

    • QrCodeEncoder

      public QrCodeEncoder()
  • Method Details

    • reset

      public void reset()
    • setVersion

      public QrCodeEncoder setVersion(int version)
    • setError

      public QrCodeEncoder setError(@Nullable QrCode.ErrorLevel level)
    • setMask

      public QrCodeEncoder setMask(QrCodeMaskPattern pattern)
    • addAutomatic

      public QrCodeEncoder addAutomatic(String message)
      Select the encoding based on the letters in the message. A very simple algorithm is used internally.
    • addNumeric

      public QrCodeEncoder addNumeric(String message)
      Creates a QR-Code which encodes a number sequence
      Parameters:
      message - String that specifies numbers and no other types. Each number has to be from 0 to 9 inclusive.
      Returns:
      The QR-Code
    • addNumeric

      public QrCodeEncoder addNumeric(byte[] numbers)
      Creates a QR-Code which encodes a number sequence
      Parameters:
      numbers - Array of numbers. Each number has to be from 0 to 9 inclusive.
      Returns:
      The QR-Code
    • addAlphanumeric

      public QrCodeEncoder addAlphanumeric(String alphaNumeric)
      Creates a QR-Code which encodes data in the alphanumeric format
      Parameters:
      alphaNumeric - String containing only alphanumeric values.
      Returns:
      The QR-Code
    • addBytes

      public QrCodeEncoder addBytes(String message)
    • addBytes

      public QrCodeEncoder addBytes(byte[] data)
      Creates a QR-Code which encodes data in the byte format.
      Parameters:
      data - Data to be encoded
      Returns:
      The QR-Code
    • addKanji

      public QrCodeEncoder addKanji(String message)
      Creates a QR-Code which encodes Kanji characters
      Parameters:
      message - Data to be encoded
      Returns:
      The QR-Code
    • getLengthBitsNumeric

      public static int getLengthBitsNumeric(int version)
    • getLengthBitsAlphanumeric

      public static int getLengthBitsAlphanumeric(int version)
    • getLengthBitsBytes

      public static int getLengthBitsBytes(int version)
    • getLengthBitsKanji

      public static int getLengthBitsKanji(int version)
    • fixate

      public QrCode fixate()
      Call this function after you are done adding to the QR code
      Returns:
      The generated QR Code
    • bitsToMessage

      protected void bitsToMessage(PackedBits8 stream)
    • getByteCharacterSet

      public Charset getByteCharacterSet()
    • setByteCharacterSet

      public void setByteCharacterSet(Charset byteCharacterSet)
    • sizeInBits

      public int sizeInBits(QrCodeCodecBitsUtils.MessageSegment segment, int version)