zxing Interface for a class to convert a BitMatrix to an output image format Renders the specified matrix to its graphically representation The matrix. The format. The encoded content of the barcode which should be included in the image. That can be the numbers below a 1D barcode or something other. Renders the specified matrix to its graphically representation The matrix. The format. The encoded content of the barcode which should be included in the image. That can be the numbers below a 1D barcode or something other. The options. represents the generated code as a byte array with pixel data (4 byte per pixel, BGRA) the generated code as byte array of BGRA pixels the width of the image the height of the image Renders a to an byte array with pixel data (4 byte per pixel, BGRA) represents a color defined as ARGB byte data the color black the color white value of the alpha channel value of the red channel value of the green channel value of the blue channel Initializes a new instance of the struct. Gets or sets the foreground color. The foreground color. Gets or sets the background color. The background color. Initializes a new instance of the class. Renders the specified matrix. The matrix. The format. The content. Renders the specified matrix. The matrix. The format. The content. The options. Renders a barcode into a Svg image the default font name if nothing else is set (Arial) the default font size if nothing else is set (10) represents a color value color black color white alpha channel red channel green channel blur channel initializing constructor initializing constructor Gets or sets the foreground color. The foreground color. Gets or sets the background color. The background color. Gets or sets the font family name The font family name. Gets or sets the font size in pixel The font size in pixel. Initializes a new instance of the class. Renders the specified matrix. The matrix. The format. The content. Renders the specified matrix. The matrix. The format. The content. The options. Represents a barcode as a Svg image Gets or sets the content. The content. The original height of the bitmatrix for the barcode The original width of the bitmatrix for the barcode Initializes a new instance of the class. Initializes a new instance of the class. Initializes a new instance of the class. The content. Gives the XML representation of the SVG image Renders a to a Foreground/filled Char. Background/blank Char. Enumerates barcode formats known to this package. Sean Owen Aztec 2D barcode format. CODABAR 1D format. Code 39 1D format. Code 93 1D format. Code 128 1D format. Data Matrix 2D barcode format. EAN-8 1D format. EAN-13 1D format. ITF (Interleaved Two of Five) 1D format. MaxiCode 2D barcode format. PDF417 format. QR Code 2D barcode format. RSS 14 RSS EXPANDED UPC-A 1D format. UPC-E 1D format. UPC/EAN extension format. Not a stand-alone format. MSI Plessey Intelligent Mail barcode Pharmacode format. UPC_A | UPC_E | EAN_13 | EAN_8 | CODABAR | CODE_39 | CODE_93 | CODE_128 | ITF | RSS_14 | RSS_EXPANDED without MSI (to many false-positives) and IMB (not enough tested, and it looks more like a 2D) A smart class to decode the barcode inside a bitmap object Initializes a new instance of the class. Initializes a new instance of the class. Sets the reader which should be used to find and decode the barcode. If null then MultiFormatReader is used Sets the function to create a luminance source object for a bitmap. If null, an exception is thrown when Decode is called Sets the function to create a binarizer object for a luminance source. If null then HybridBinarizer is used Initializes a new instance of the class. Sets the reader which should be used to find and decode the barcode. If null then MultiFormatReader is used Sets the function to create a luminance source object for a bitmap. If null, an exception is thrown when Decode is called Sets the function to create a binarizer object for a luminance source. If null then HybridBinarizer is used Sets the function to create a luminance source object for a rgb raw byte array. Constructor for additional image formats for one BarcodeReader class Sets the reader which should be used to find and decode the barcode. If null then MultiFormatReader is used Sets the function to create a binarizer object for a luminance source. If null then HybridBinarizer is used Sets the function to create a luminance source object for a rgb raw byte array. Optional: Gets or sets the function to create a luminance source object for a bitmap. If null a platform specific default LuminanceSource is used The function to create a luminance source object. Decodes the specified barcode bitmap. The barcode bitmap. the result data or null Decodes the specified barcode bitmap. The barcode bitmap. the result data or null A smart class to decode the barcode inside a bitmap object represents the default function which is called to get a instance from a raw byte array Gets or sets the options. The options. Gets the reader which should be used to find and decode the barcode. The reader. Gets or sets a method which is called if an important point is found The result point callback. event is executed if a result was found via decode Gets or sets a value indicating whether the image should be automatically rotated. Rotation is supported for 90, 180 and 270 degrees true if image should be rotated; otherwise, false. Gets or sets a value indicating whether the image should be automatically inverted if no result is found in the original image. ATTENTION: Please be carefully because it slows down the decoding process if it is used true if image should be inverted; otherwise, false. Optional: Gets or sets the function to create a binarizer object for a luminance source. If null then HybridBinarizer is used The function to create a binarizer object. Initializes a new instance of the class. Initializes a new instance of the class. Sets the reader which should be used to find and decode the barcode. If null then MultiFormatReader is used Sets the function to create a binarizer object for a luminance source. If null then HybridBinarizer is used Sets the function to create a luminance source object for a rgb array. If null the RGBLuminanceSource is used. The handler is only called when Decode with a byte[] array is called. Tries to decode a barcode within an image which is given by a luminance source. That method gives a chance to prepare a luminance source completely before calling the time consuming decoding method. On the other hand there is a chance to create a luminance source which is independent from external resources (like Bitmap objects) and the decoding call can be made in a background thread. The luminance source. Tries to decode barcodes within an image which is given by a luminance source. That method gives a chance to prepare a luminance source completely before calling the time consuming decoding method. On the other hand there is a chance to create a luminance source which is independent from external resources (like Bitmap objects) and the decoding call can be made in a background thread. The luminance source. raises the ResultFound event raises the ResultFound event calls the explicitResultPointFound action Decodes the specified barcode bitmap. The image as byte[] array. The width. The height. The format. the result data or null Decodes the specified barcode bitmap. The image as byte[] array. The width. The height. The format. the result data or null A smart class to encode some content to raw pixel data Initializes a new instance of the class. A smart class to encode some content to a svg barcode image Initializes a new instance of the class. A base class for specific barcode writers with specific formats of barcode images. The type of the output. Gets or sets the renderer which should be used to render the encoded BitMatrix. Encodes the specified contents and returns a rendered instance of the barcode. For rendering the instance of the property Renderer is used and has to be set before calling that method. The contents. Returns a rendered instance of the barcode which is given by a BitMatrix. For rendering the instance of the property Renderer is used and has to be set before calling that method. The matrix. A base class for specific barcode writers with specific formats of barcode images. Gets or sets the barcode format. The value is only suitable if the MultiFormatWriter is used. Gets or sets the options container for the encoding and renderer process. Gets or sets the writer which encodes the content to a BitMatrix. If no value is set the MultiFormatWriter is used. Encodes the specified contents and returns a BitMatrix array. That array has to be rendered manually or with a IBarcodeRenderer. The contents. The base class for luminance sources which supports cropping and rotating based upon the luminance values. weight of the red channel for calculating a gray scale image weight of the green channel for calculating a gray scale image weight of the blue channel for calculating a gray scale image numbers of bits which for right shifting Initializes a new instance of the class. The width. The height. Initializes a new instance of the class. The luminance array. The width. The height. Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getMatrix() may never be called. The row to fetch, 0 <= y < Height. An optional preallocated array. If null or too small, it will be ignored. Always use the returned object, and ignore the .length of the array. An array containing the luminance data. gets the luminance matrix Returns a new object with rotated image data by 90 degrees counterclockwise. Only callable if {@link #isRotateSupported()} is true. A rotated version of this object. TODO: not implemented yet A rotated version of this object. Whether this subclass supports counter-clockwise rotation. Returns a new object with cropped image data. Implementations may keep a reference to the original data rather than a copy. Only callable if CropSupported is true. The left coordinate, 0 <= left < Width. The top coordinate, 0 <= top <= Height. The width of the rectangle to crop. The height of the rectangle to crop. A cropped version of this object. Whether this subclass supports cropping. Whether this subclass supports invertion. Inverts the luminance values (newValue = 255 - oldValue) Should create a new luminance source with the right class type. The method is used in methods crop and rotate. The new luminances. The width. The height. This class hierarchy provides a set of methods to convert luminance data to 1 bit data. It allows the algorithm to vary polymorphically, for example allowing a very expensive thresholding technique for servers and a fast one for mobile. It also permits the implementation to vary, e.g. a JNI version for Android and a Java fallback version for other platforms. dswitkin@google.com (Daniel Switkin) Initializes a new instance of the class. The source. Gets the luminance source object. Converts one row of luminance data to 1 bit data. May actually do the conversion, or return cached data. Callers should assume this method is expensive and call it as seldom as possible. This method is intended for decoding 1D barcodes and may choose to apply sharpening. For callers which only examine one row of pixels at a time, the same BitArray should be reused and passed in with each call for performance. However it is legal to keep more than one row at a time if needed. The row to fetch, which must be in [0, bitmap height) An optional preallocated array. If null or too small, it will be ignored. If used, the Binarizer will call BitArray.clear(). Always use the returned object. The array of bits for this row (true means black). Converts a 2D array of luminance data to 1 bit data. As above, assume this method is expensive and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or may not apply sharpening. Therefore, a row from this matrix may not be identical to one fetched using getBlackRow(), so don't mix and match between them. The 2D array of bits for the image (true means black). Creates a new object with the same type as this Binarizer implementation, but with pristine state. This is needed because Binarizer implementations may be stateful, e.g. keeping a cache of 1 bit data. See Effective Java for why we can't use Java's clone() method. The LuminanceSource this Binarizer will operate on. A new concrete Binarizer implementation object. Gets the width of the luminance source object. Gets the height of the luminance source object. This class is the core bitmap class used by ZXing to represent 1 bit data. Reader objects accept a BinaryBitmap and attempt to decode it. dswitkin@google.com (Daniel Switkin) The width of the bitmap. The height of the bitmap. Converts one row of luminance data to 1 bit data. May actually do the conversion, or return cached data. Callers should assume this method is expensive and call it as seldom as possible. This method is intended for decoding 1D barcodes and may choose to apply sharpening. The row to fetch, which must be in [0, bitmap height). An optional preallocated array. If null or too small, it will be ignored. If used, the Binarizer will call BitArray.clear(). Always use the returned object. The array of bits for this row (true means black). Converts a 2D array of luminance data to 1 bit. As above, assume this method is expensive and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or may not apply sharpening. Therefore, a row from this matrix may not be identical to one fetched using getBlackRow(), so don't mix and match between them. The 2D array of bits for the image (true means black). Whether this bitmap can be cropped. Returns a new object with cropped image data. Implementations may keep a reference to the original data rather than a copy. Only callable if isCropSupported() is true. The left coordinate, which must be in [0, Width) The top coordinate, which must be in [0, Height) The width of the rectangle to crop. The height of the rectangle to crop. A cropped version of this object. Whether this bitmap supports counter-clockwise rotation. Returns a new object with rotated image data by 90 degrees counterclockwise. Only callable if is true. A rotated version of this object. Returns a new object with rotated image data by 45 degrees counterclockwise. Only callable if is true. A rotated version of this object. Returns a that represents this instance. A that represents this instance. Encapsulates a type of hint that a caller may pass to a barcode reader to help it more quickly or accurately decode it. It is up to implementations to decide what, if anything, to do with the information that is supplied. Sean Owen dswitkin@google.com (Daniel Switkin) Unspecified, application-specific hint. Maps to an unspecified . Image is a pure monochrome image of a barcode. Doesn't matter what it maps to; use = true. Image is known to be of one of a few possible formats. Maps to a of s. Spend more time to try to find a barcode; optimize for accuracy, not speed. Doesn't matter what it maps to; use = true. Specifies what character encoding to use when decoding, where applicable (type String) Allowed lengths of encoded data -- reject anything else. Maps to an int[]. Assume Code 39 codes employ a check digit. Maps to . The caller needs to be notified via callback when a possible is found. Maps to a . Assume MSI codes employ a check digit. Maps to . if Code39 could be detected try to use extended mode for full ASCII character set Maps to . Don't fail if a Code39 is detected but can't be decoded in extended mode. Return the raw Code39 result instead. Maps to . 1D readers supporting rotation with TRY_HARDER enabled. But BarcodeReader class can do auto-rotating for 1D and 2D codes. Enabling that option prevents 1D readers doing double rotation. BarcodeReader enables that option automatically if "global" auto-rotation is enabled. Maps to . Assume the barcode is being processed as a GS1 barcode, and modify behavior as needed. For example this affects FNC1 handling for Code 128 (aka GS1-128). Doesn't matter what it maps to; use . If true, return the start and end digits in a Codabar barcode instead of stripping them. They are alpha, whereas the rest are numeric. By default, they are stripped, but this causes them to not be. Doesn't matter what it maps to; use . Allowed extension lengths for EAN or UPC barcodes. Other formats will ignore this. Maps to an int[] of the allowed extension lengths, for example [2], [5], or [2, 5]. If it is optional to have an extension, do not set this hint. If this is set, and a UPC or EAN barcode is found but an extension is not, then no result will be returned at all. If true, also tries to decode as inverted image. All configured decoders are simply called a second time with an inverted image. Doesn't matter what it maps to; use {@link Boolean#TRUE}. Simply encapsulates a width and height. initializing constructor the width the height These are a set of hints that you may pass to Writers to specify their behavior. dswitkin@google.com (Daniel Switkin) Specifies the width of the barcode image type: Specifies the height of the barcode image type: Don't put the content string into the output image. type: Specifies what degree of error correction to use, for example in QR Codes. Type depends on the encoder. For example for QR codes it's type For Aztec it is of type , representing the minimal percentage of error correction words. In all cases, it can also be a representation of the desired value as well. Note: an Aztec symbol should have a minimum of 25% EC words. For PDF417 it is of type or (between 0 and 8), Specifies what character encoding to use where applicable. type: Specifies margin, in pixels, to use when generating the barcode. The meaning can vary by format; for example it controls margin before and after the barcode horizontally for most 1D formats. type: , or representation of the integer value Specifies the aspect ratio to use. Default is 4. type: , or 1-4. Specifies the desired aspect ratio (number of columns / number of rows) of the output image. Default is 3. type: . Specifies whether to use compact mode for PDF417 type: , or "true" or "false" value Specifies what compaction mode to use for PDF417. type: or value of one of its enum values Specifies the minimum and maximum number of rows and columns for PDF417. type: The Specifies that the PDF417 will contain macro metadata. type: Don't append ECI segment. That is against the specification of QR Code but some readers have problems if the charset is switched from ISO-8859-1 (default) to UTF-8 with the necessary ECI segment. If you set the property to true you can use UTF-8 encoding and the ECI segment is omitted. type: Specifies the matrix shape for Data Matrix (type ) Specifies a minimum barcode size (type ). Only applicable to Data Matrix now. Specifies a maximum barcode size (type ). Only applicable to Data Matrix now. if true, don't switch to codeset C for numbers Specifies the default encodation for Data Matrix (type ) Make sure that the content fits into the encodation value, otherwise there will be an exception thrown. standard value: Encodation.ASCII Specifies the required number of layers for an Aztec code. A negative number (-1, -2, -3, -4) specifies a compact Aztec code 0 indicates to use the minimum number of layers (the default) A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code type: , or representation of the integer value Specifies the exact version of QR code to be encoded. (Type , or representation of the integer value). Specifies whether the data should be encoded to the GS1 standard type: , or "true" or "false" value Specifies the QR code mask pattern to be used. Allowed values are 0..QRCode.NUM_MASK_PATTERNS-1. By default the code will automatically select the optimal mask pattern. (Type , or representation of the integer value). Forces which encoding will be used. Currently only used for Code-128 code sets (Type ). Valid values are "A", "B", "C". see also CODE128_FORCE_CODESET_B This option and {@link #CODE128_COMPACT} are mutually exclusive. Specifies whether to use compact mode for QR code (type , or "true" or "false" Please note that when compaction is performed, the most compact character encoding is chosen for characters in the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by means of the encoding hint. if set to true, barcode writer uses WIDTH and HEIGHT as maximum values and in combination with MARGIN=0 there is no white border added. The resulting image would be smaller than the requested size. Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false" The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1 character set via ECIs. Please note that in that case, the most compact character encoding is chosen for characters in the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by means of the {@link #CHARACTER_SET} encoding hint. Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords for the purpose of delimiting AIs. This option and {@link #FORCE_C40} are mutually exclusive. Specifies whether to use compact mode for Code-128 code (type {@link Boolean}, or "true" or "false" This can yield slightly smaller bar codes. This option and {@link #FORCE_CODE_SET} are mutually exclusive options. Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive. Specifies whether to automatically insert ECIs when encoding PDF417 (type {@link Boolean}, or "true" or "false" {@link String} value). Please note that in that case, the most compact character encoding is chosen for characters in the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by means of the {@link #CHARACTER_SET} encoding hint. Thrown when a barcode was successfully detected, but some aspect of the content did not conform to the barcode's format rules. This could have been due to a mis-detection. Sean Owen Interface for a smart class to decode the barcode inside a bitmap object Interface for a smart class to decode multiple barcodes inside a bitmap object event is executed when a result point was found event is executed when a result was found via decode Specifies some options which influence the decoding process Decodes the specified barcode bitmap which is given by a generic byte array with the order RGB24. The image as RGB24 array. The width. The height. The format. the result data or null Tries to decode a barcode within an image which is given by a luminance source. That method gives a chance to prepare a luminance source completely before calling the time consuming decoding method. On the other hand there is a chance to create a luminance source which is independent from external resources (like Bitmap objects) and the decoding call can be made in a background thread. The luminance source. Decodes the specified barcode bitmap which is given by a generic byte array with the order RGB24. The image as RGB24 array. The width. The height. The format. the result data or null Tries to decode barcodes within an image which is given by a luminance source. That method gives a chance to prepare a luminance source completely before calling the time consuming decoding method. On the other hand there is a chance to create a luminance source which is independent from external resources (like Bitmap objects) and the decoding call can be made in a background thread. The luminance source. Interface for a smart class to decode the barcode inside a bitmap object Interface for a smart class to decode multiple barcodes inside a bitmap object Decodes the specified barcode bitmap. The barcode bitmap. the result data or null Decodes the specified barcode bitmap. The barcode bitmap. the result data or null Interface for a smart class to decode the barcode inside a bitmap object Interface for a smart class to decode multiple barcodes inside a bitmap object event is executed when a result point was found event is executed when a result was found via decode Specifies some options which influence the decoding process Decodes the specified barcode bitmap which is given by a generic byte array. The barcode bitmap. The width. The height. The format. the result data or null Tries to decode a barcode within an image which is given by a luminance source. That method gives a chance to prepare a luminance source completely before calling the time consuming decoding method. On the other hand there is a chance to create a luminance source which is independent from external resources (like Bitmap objects) and the decoding call can be made in a background thread. The luminance source. Decodes the specified barcode bitmap which is given by a generic byte array with the order RGB24. The barcode bitmap. The width. The height. The format. the result data or null Tries to decode barcodes within an image which is given by a luminance source. That method gives a chance to prepare a luminance source completely before calling the time consuming decoding method. On the other hand there is a chance to create a luminance source which is independent from external resources (like Bitmap objects) and the decoding call can be made in a background thread. The luminance source. Interface for a smart class to encode some content into a barcode Get or sets the barcode format which should be generated (only suitable if MultiFormatWriter is used for property Encoder which is the default) Gets or sets the options container for the encoding and renderer process. Gets or sets the writer which encodes the content to a BitMatrix. If no value is set the MultiFormatWriter is used. Encodes the specified contents. The contents. Interface for a smart class to encode some content into a barcode Creates a visual representation of the contents Returns a rendered instance of the barcode which is given by a BitMatrix. Interface for a smart class to encode some content into a barcode Creates a visual representation of the contents Returns a rendered instance of the barcode which is given by a BitMatrix. Interface for a smart class to encode some content into a barcode Creates a visual representation of the contents The contents. Returns a rendered instance of the barcode which is given by a BitMatrix. The matrix. Interface for a smart class to encode some content into a barcode Get or sets the barcode format which should be generated (only suitable if MultiFormatWriter is used for property Encoder which is the default) Gets or sets the options container for the encoding and renderer process. Gets or sets the writer which encodes the content to a BitMatrix. If no value is set the MultiFormatWriter is used. Encodes the specified contents. The contents. A wrapper implementation of {@link LuminanceSource} which inverts the luminances it returns -- black becomes white and vice versa, and each value becomes (255-value). Sean Owen Initializes a new instance of the class. The @delegate. Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have to bitwise and with 0xff for each value. It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getMatrix() may never be called. The row to fetch, 0 <= y < Height. An optional preallocated array. If null or too small, it will be ignored. Always use the returned object, and ignore the .length of the array. An array containing the luminance data. Fetches luminance data for the underlying bitmap. Values should be fetched using: int luminance = array[y * width + x] & 0xff; A row-major 2D array of luminance values. Do not use result.length as it may be larger than width * height bytes on some platforms. Do not modify the contents of the result. Whether this subclass supports cropping. Returns a new object with cropped image data. Implementations may keep a reference to the original data rather than a copy. Only callable if CropSupported is true. The left coordinate, 0 <= left < Width. The top coordinate, 0 <= top <= Height. The width of the rectangle to crop. The height of the rectangle to crop. A cropped version of this object. Whether this subclass supports counter-clockwise rotation. Inverts this instance. original delegate {@link LuminanceSource} since invert undoes itself Returns a new object with rotated image data by 90 degrees counterclockwise. Only callable if {@link #isRotateSupported()} is true. A rotated version of this object. Returns a new object with rotated image data by 45 degrees counterclockwise. Only callable if {@link #isRotateSupported()} is true. A rotated version of this object. The purpose of this class hierarchy is to abstract different bitmap implementations across platforms into a standard interface for requesting greyscale luminance values. The interface only provides immutable methods; therefore crop and rotation create copies. This is to ensure that one Reader does not modify the original luminance source and leave it in an unknown state for other Readers in the chain. dswitkin@google.com (Daniel Switkin) initializing constructor Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have to bitwise and with 0xff for each value. It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getMatrix() may never be called. The row to fetch, which must be in [0, bitmap height) An optional preallocated array. If null or too small, it will be ignored. Always use the returned object, and ignore the .length of the array. An array containing the luminance data. Fetches luminance data for the underlying bitmap. Values should be fetched using: int luminance = array[y * width + x] & 0xff A row-major 2D array of luminance values. Do not use result.length as it may be larger than width * height bytes on some platforms. Do not modify the contents of the result. The width of the bitmap. The height of the bitmap. Whether this subclass supports cropping. Returns a new object with cropped image data. Implementations may keep a reference to the original data rather than a copy. Only callable if CropSupported is true. The left coordinate, which must be in [0, Width) The top coordinate, which must be in [0, Height) The width of the rectangle to crop. The height of the rectangle to crop. A cropped version of this object. Whether this subclass supports counter-clockwise rotation. Returns a new object with rotated image data by 90 degrees counterclockwise. Only callable if is true. A rotated version of this object. Returns a new object with rotated image data by 45 degrees counterclockwise. Only callable if is true. A rotated version of this object. Whether this subclass supports invertion. inverts the luminance values, not supported here. has to implemented in sub classes MultiFormatReader is a convenience class and the main entry point into the library for most uses. By default it attempts to decode all barcode formats that the library supports. Optionally, you can provide a hints object to request different behavior, for example only decoding QR codes. Sean Owen dswitkin@google.com (Daniel Switkin) www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source This version of decode honors the intent of Reader.decode(BinaryBitmap) in that it passes null as a hint to the decoders. However, that makes it inefficient to call repeatedly. Use setHints() followed by decodeWithState() for continuous scan applications. The pixel data to decode The contents of the image ReaderException Any errors which occurred Decode an image using the hints provided. Does not honor existing state. The pixel data to decode The hints to use, clearing the previous state. The contents of the image ReaderException Any errors which occurred Decode an image using the state set up by calling setHints() previously. Continuous scan clients will get a large speed increase by using this instead of decode(). The pixel data to decode The contents of the image ReaderException Any errors which occurred This method adds state to the MultiFormatReader. By setting the hints once, subsequent calls to decodeWithState(image) can reuse the same set of readers without reallocating memory. This is important for performance in continuous scan clients. resets all specific readers This is a factory class which finds the appropriate Writer subclass for the BarcodeFormat requested and encodes the barcode with the supplied contents. dswitkin@google.com (Daniel Switkin) www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source Gets the collection of supported writers. encode the given data encode the given data This object extends LuminanceSource around an array of YUV data returned from the camera driver, with the option to crop to a rectangle within the full data. This can be used to exclude superfluous pixels around the perimeter and speed up decoding. It works for any pixel format where the Y channel is planar and appears first, including YCbCr_420_SP and YCbCr_422_SP. @author dswitkin@google.com (Daniel Switkin) Initializes a new instance of the class. The yuv data. Width of the data. Height of the data. The left. The top. The width. The height. if set to true [reverse horiz]. Initializes a new instance of the class. The luminances. The width. The height. Fetches one row of luminance data from the underlying platform's bitmap. Values range from 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have to bitwise and with 0xff for each value. It is preferable for implementations of this method to only fetch this row rather than the whole image, since no 2D Readers may be installed and getMatrix() may never be called. The row to fetch, 0 <= y < Height. An optional preallocated array. If null or too small, it will be ignored. Always use the returned object, and ignore the .length of the array. An array containing the luminance data. Whether this subclass supports cropping. Returns a new object with cropped image data. Implementations may keep a reference to the original data rather than a copy. Only callable if CropSupported is true. The left coordinate, 0 <= left < Width. The top coordinate, 0 <= top <= Height. The width of the rectangle to crop. The height of the rectangle to crop. A cropped version of this object. Renders the cropped greyscale bitmap. width of image from {@link #renderThumbnail()} height of image from {@link #renderThumbnail()} creates a new instance Implementations of this interface can decode an image of a barcode in some format into the String it encodes. For example, can decode a QR code. The decoder may optionally receive hints from the caller which may help it decode more quickly or accurately. See , which attempts to determine what barcode format is present within the image as well, and then decodes it accordingly. Sean Owen dswitkin@google.com (Daniel Switkin) Locates and decodes a barcode in some format within an image. image of barcode to decode String which the barcode encodes Locates and decodes a barcode in some format within an image. This method also accepts hints, each possibly associated to some data, which may help the implementation decode. image of barcode to decode passed as a from to arbitrary data. The meaning of the data depends upon the hint type. The implementation may or may not do anything with these hints. String which the barcode encodes Resets any internal state the implementation has after a decode, to prepare it for reuse. The general exception class throw when something goes wrong during decoding of a barcode. This includes, but is not limited to, failing checksums / error correction algorithms, being unable to locate finder timing patterns, and so on. Sean Owen Initializes a new instance of the class. Initializes a new instance of the class. Initializes a new instance of the class. The inner exception. Initializes a new instance of the class. The inner exception. Encapsulates the result of decoding a barcode within an image. raw text encoded by the barcode, if applicable, otherwise null raw bytes encoded by the barcode, if applicable, otherwise null points related to the barcode in the image. These are typically points identifying finder patterns or the corners of the barcode. The exact meaning is specific to the type of barcode that was decoded. {@link BarcodeFormat} representing the format of the barcode that was decoded {@link Hashtable} mapping {@link ResultMetadataType} keys to values. May be null. This contains optional metadata about what was detected about the barcode, like orientation. Gets the timestamp. how many bits of are valid; typically 8 times its length Initializes a new instance of the class. The text. The raw bytes. The result points. The format. Initializes a new instance of the class. The text. The raw bytes. The result points. The format. Initializes a new instance of the class. The text. The raw bytes. The result points. The format. The timestamp. Initializes a new instance of the class. The text. The raw bytes. The result points. The format. The timestamp. Adds one metadata to the result The type. The value. Adds a list of metadata to the result The metadata. Adds the result points. The new points. Returns a that represents this instance. A that represents this instance. Represents some type of metadata about the result of the decoding that the decoder wishes to communicate back to the caller. Sean Owen Unspecified, application-specific metadata. Maps to an unspecified {@link Object}. Denotes the likely approximate orientation of the barcode in the image. This value is given as degrees rotated clockwise from the normal, upright orientation. For example a 1D barcode which was found by reading top-to-bottom would be said to have orientation "90". This key maps to an {@link Integer} whose value is in the range [0,360).

2D barcode formats typically encode text, but allow for a sort of 'byte mode' which is sometimes used to encode binary data. While {@link Result} makes available the complete raw bytes in the barcode for these formats, it does not offer the bytes from the byte segments alone.

This maps to a {@link java.util.List} of byte arrays corresponding to the raw bytes in the byte segments in the barcode, in order.

Error correction level used, if applicable. The value type depends on the format, but is typically a String. For some periodicals, indicates the issue number as an {@link Integer}. For some products, indicates the suggested retail price in the barcode as a formatted {@link String}. For some products, the possible country of manufacture as a {@link String} denoting the ISO country code. Some map to multiple possible countries, like "US/CA". For some products, the extension text If the code format supports structured append and the current scanned code is part of one then the sequence number is given with it. If the code format supports structured append and the current scanned code is part of one then the parity is given with it. PDF417-specific metadata Aztec-specific metadata Barcode Symbology Identifier. Note: According to the GS1 specification the identifier may have to replace a leading FNC1/GS character when prepending to the barcode content. The bit mask applied to a QR code Encapsulates a point of interest in an image containing a barcode. Typically, this would be the location of a finder pattern or the corner of the barcode, for example. Sean Owen Initializes a new instance of the class. Initializes a new instance of the class. The x. The y. Gets the X. Gets the Y. Determines whether the specified is equal to this instance. The to compare with this instance. true if the specified is equal to this instance; otherwise, false. Returns a hash code for this instance. A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. Returns a that represents this instance. A that represents this instance. Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC and BC is less than AC and the angle between BC and BA is less than 180 degrees. array of three to order calculates the distance between two points first pattern second pattern distance between two points Returns the z component of the cross product between vectors BC and BA. Callback which is invoked when a possible result point (significant point in the barcode image such as a corner) is found. Luminance source class which support different formats of images. enumeration of supported bitmap format which the RGBLuminanceSource can process format of the byte[] isn't known. RGBLuminanceSource tries to determine the best possible value grayscale array, the byte array is a luminance array with 1 byte per pixel grayscale array, the byte array is a luminance array with 2 bytes per pixel 3 bytes per pixel with the channels red, green and blue 4 bytes per pixel with the channels red, green and blue 4 bytes per pixel with the channels alpha, red, green and blue 3 bytes per pixel with the channels blue, green and red 4 bytes per pixel with the channels blue, green and red 4 bytes per pixel with the channels blue, green, red and alpha 2 bytes per pixel, 5 bit red, 6 bits green and 5 bits blue 4 bytes per pixel with the channels red, green, blue and alpha 4 bytes for two pixels, UYVY formatted 4 bytes for two pixels, YUYV formatted Initializes a new instance of the class. The width. The height. Initializes a new instance of the class. It supports a byte array with 3 bytes per pixel (RGB24). The RGB raw bytes. The width. The height. Initializes a new instance of the class. It supports a byte array with 1 byte per pixel (Gray8). That means the whole array consists of the luminance values (grayscale). The luminance array. The width. The height. if set to true [is8 bit]. Initializes a new instance of the class. It supports a byte array with 3 bytes per pixel (RGB24). The RGB raw bytes. The width. The height. The bitmap format. Should create a new luminance source with the right class type. The method is used in methods crop and rotate. The new luminances. The width. The height. calculates the luminance values for the given byte array and bitmap format Contains conversion support elements such as classes, interfaces and static methods. Copies an array of chars obtained from a String into a specified array of chars The String to get the chars from Position of the String to start getting the chars Position of the String to end getting the chars Array to return the chars Position of the destination array of chars to start storing the chars An array of chars Sets the capacity for the specified List The List which capacity will be set The new capacity value Converts a string-Collection to an array The strings. Joins all elements to one string. The separator. The values. Fills the specified array. (can't use extension method because of .Net 2.0 support) The array. The value. Fills the specified array. (can't use extension method because of .Net 2.0 support) The array. The start index. The end index. The value. Savely gets the value of a decoding hint if hints is null the default is returned The hints. Type of the hint. The @default. The base class for all objects which encode/generate a barcode image. dswitkin@google.com (Daniel Switkin) www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source Encode a barcode using the default settings. The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels Additional parameters to supply to the encoder The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) A base class which covers the range of exceptions which may occur when encoding a barcode using the Writer framework. dswitkin@google.com (Daniel Switkin) Initializes a new instance of the class. Initializes a new instance of the class. The message. Initializes a new instance of the class. The message. The inner exc. Extends with more information specific to the Aztec format, like the number of layers and whether it's compact. Gets a value indicating whether this Aztec code is compact. true if compact; otherwise, false. Gets the nb datablocks. Gets the nb layers. Initializes a new instance of the class. The bits. The points. if set to true [compact]. The nb datablocks. The nb layers. The main class which implements Aztec Code decoding -- as opposed to locating and extracting the Aztec Code from an image. David Olivier Decodes the specified detector result. The detector result. This method is used for testing the high-level encoder Gets the string encoded in the aztec code bits The corrected bits. the decoded string gets the table corresponding to the char passed The t. Gets the character (or string) corresponding to the passed code in the given table the table used the code of the character Performs RS error correction on an array of bits. The rawbits. the corrected array Gets the array of bits from an Aztec Code matrix The matrix. the array of bits Reads a code of given length and at given index in an array of bits The rawbits. The start index. The length. Reads a code of length 8 in an array of bits, padding with zeros Packs a bit array into bytes, most significant bit first Encapsulates logic that can detect an Aztec Code in an image, even if the Aztec Code is rotated or skewed, or partially obscured. David Olivier Initializes a new instance of the class. The image. Detects an Aztec Code in an image. Detects an Aztec Code in an image. if true, image is a mirror-image of original. encapsulating results of detecting an Aztec Code Extracts the number of data layers and data blocks from the layer around the bull's eye bullEyeCornerPoints the array of bull's eye corners Corrects the parameter bits using Reed-Solomon algorithm paremeter bits compact true if this is a compact Aztec code Finds the corners of a bull-eye centered on the passed point This returns the centers of the diagonal points just outside the bull's eye Returns [topRight, bottomRight, bottomLeft, topLeft] Center point The corners of the bull-eye Finds a candidate center point of an Aztec code from an image the center point Gets the Aztec code corners from the bull's eye corners and the parameters. the array of bull's eye corners the array of aztec code corners Creates a BitMatrix by sampling the provided image. topLeft, topRight, bottomRight, and bottomLeft are the centers of the squares on the diagonal just outside the bull's eye. The image. The top left. The bottom left. The bottom right. The top right. Samples a line start point (inclusive) end point (exclusive) number of bits the array of bits as an int (first bit is high-order bit of result) Determines whether [is white or black rectangle] [the specified p1]. The p1. The p2. The p3. The p4. true if the border of the rectangle passed in parameter is compound of white points only or black points only Gets the color of a segment The p1. The p2. 1 if segment more than 90% black, -1 if segment is more than 90% white, 0 else Gets the coordinate of the first point with a different color in the given direction The init. if set to true [color]. The dx. The dy. Expand the square represented by the corner points by pushing out equally in all directions the corners of the square, which has the bull's eye at its center the original length of the side of the square in the target bit matrix the new length of the size of the square in the target bit matrix the corners of the expanded square Aztec 2D code representation Rustam Abdullaev Compact or full symbol indicator Size in pixels (width and height) Number of levels Number of data codewords The symbol image represents a token for a binary shift initializing constructor appends the byte array to the BitArray string representation Generates Aztec 2D barcodes. Rustam Abdullaev default EC percent 33 default layers 0 Encodes the given string content as an Aztec symbol (without ECI code) input data string; must be encodable as ISO/IEC 8859-1 (Latin-1) Aztec symbol matrix with metadata input data string; must be encodable as ISO/IEC 8859-1 (Latin-1) minimal percentage of error check words (According to ISO/IEC 24778:2008, a minimum of 23% + 3 words is recommended) if non-zero, a user-specified value for the number of layers Aztec symbol matrix with metadata Encodes the given string content as an Aztec symbol input data string minimal percentage of error check words (According to ISO/IEC 24778:2008, a minimum of 23% + 3 words is recommended) if non-zero, a user-specified value for the number of layers character set in which to encode string using ECI; if null, no ECI code will be inserted, and the string must be encodable as ISO/IEC 8859-1 (Latin-1), the default encoding of the symbol. Aztec symbol matrix with metadata Encodes the given string content as an Aztec symbol input data string minimal percentage of error check words (According to ISO/IEC 24778:2008, a minimum of 23% + 3 words is recommended) if non-zero, a user-specified value for the number of layers character set in which to encode string using ECI; if null, no ECI code will be inserted, and the string must be encodable as ISO/IEC 8859-1 (Latin-1), the default encoding of the symbol. if true, dont't add ECI segment Aztec symbol matrix with metadata Encodes the given binary content as an Aztec symbol (without ECI code) input data Aztec symbol matrix with metadata Encodes the given binary content as an Aztec symbol (without ECI code) input data string minimal percentage of error check words (According to ISO/IEC 24778:2008, a minimum of 23% + 3 words is recommended) if non-zero, a user-specified value for the number of layers Aztec symbol matrix with metadata Encodes the given binary content as an Aztec symbol input data string minimal percentage of error check words (According to ISO/IEC 24778:2008, a minimum of 23% + 3 words is recommended) if non-zero, a user-specified value for the number of layers character set to mark using ECI; if null, no ECI code will be inserted, and the default encoding of ISO/IEC 8859-1 will be assuming by readers. Aztec symbol matrix with metadata Encodes the given binary content as an Aztec symbol input data string minimal percentage of error check words (According to ISO/IEC 24778:2008, a minimum of 23% + 3 words is recommended) if non-zero, a user-specified value for the number of layers character set to mark using ECI; if null, no ECI code will be inserted, and the default encoding of ISO/IEC 8859-1 will be assuming by readers. if true, don't add ECI segment, regardless if encoding ist set Aztec symbol matrix with metadata This produces nearly optimal encodings of text into the first-level of encoding used by Aztec code. It uses a dynamic algorithm. For each prefix of the string, it determines a set of encodings that could lead to this prefix. We repeatedly add a character and generate a new set of optimal encodings until we have read through the entire input. @author Frank Yellin @author Rustam Abdullaev if true, disable ECI segment Convert the text represented by this High Level Encoder into a BitArray. text represented by this encoder encoded as a initializing constructor append token to bitarray string representation State represents all information about a sequence necessary to generate the current output. Note that a state is immutable. Create a new state representing this state with a latch to a (not necessary different) mode, and then a code. Create a new state representing this state, with a temporary shift to a different mode to output a single value. Create a new state representing this state, but an additional character output in Binary Shift mode. Create the state identical to this one, but we are no longer in Binary Shift mode. Returns true if "this" state is better (or equal) to be in than "that" state under all possible circumstances. represents an empty token constructor previous token adds a new simple token append to bitarray This implementation can detect and decode Aztec codes in an image. David Olivier Locates and decodes a barcode in some format within an image. image of barcode to decode a String representing the content encoded by the Data Matrix code Locates and decodes a Data Matrix code in an image. image of barcode to decode passed as a {@link java.util.Hashtable} from {@link com.google.zxing.DecodeHintType} to arbitrary data. The meaning of the data depends upon the hint type. The implementation may or may not do anything with these hints. String which the barcode encodes Resets any internal state the implementation has after a decode, to prepare it for reuse. Aztec result meta data. Gets a value indicating whether this Aztec code is compact. true if compact; otherwise, false. Gets the nb datablocks. Gets the nb layers. string represenation of that instance Renders an Aztec code as a default character set Encode a barcode using the default settings. The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels Additional parameters to supply to the encoder The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels Additional parameters to supply to the encoder The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels Encoding of the byte array Additional parameters to supply to the encoder The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) The class holds the available options for the Representing the minimal percentage of error correction words. Note: an Aztec symbol should have a minimum of 25% EC words. Specifies the required number of layers for an Aztec code: a negative number (-1, -2, -3, -4) specifies a compact Aztec code 0 indicates to use the minimum number of layers (the default) a positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code Specifies what character encoding to use where applicable (type )

See DoCoMo's documentation about the result types represented by subclasses of this class.

Thanks to Jeff Griffin for proposing rewrite of these classes that relies less on exception-based mechanisms during parsing.

Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source
Implements KDDI AU's address book format. See http://www.au.kddi.com/ezfactory/tec/two_dimensions/index.html. (Thanks to Yuzo for translating!) Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source Implements the "MECARD" address book entry format. Supported keys: N, SOUND, TEL, EMAIL, NOTE, ADR, BDAY, URL, plus ORG Unsupported keys: TEL-AV, NICKNAME Except for TEL, multiple values for keys are also not supported; the first one found takes precedence. Our understanding of the MECARD format is based on this document: http://www.mobicode.org.tw/files/OMIA%20Mobile%20Bar%20Code%20Standard%20v3.2.1.doc Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source Represents a parsed result that encodes contact information, like that in an address book entry. Sean Owen initializing constructor initializing constructor the names the nicknames In Japanese, the name is written in kanji, which can have multiple readings. Therefore a hint is often provided, called furigana, which spells the name phonetically. The pronunciation of the getNames() field, often in hiragana or katakana. the phone numbers optional descriptions of the type of each phone number. It could be like "HOME", but, there is no guaranteed or standard format. the e-mail addresses optional descriptions of the type of each e-mail. It could be like "WORK", but, there is no guaranteed or standard format. the instant messenger addresses the note field the addresses optional descriptions of the type of each e-mail. It could be like "WORK", but, there is no guaranteed or standard format. the title the organisations the urls birthday formatted as yyyyMMdd (e.g. 19780917) a location as a latitude/longitude pair Implements the "BIZCARD" address book entry format, though this has been largely reverse-engineered from examples observed in the wild -- still looking for a definitive reference. Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source Represents a parsed result that encodes a calendar event at a certain time, optionally with attendees and a location. Sean Owen initializing constructor summary Gets the start. Determines whether [is start all day]. if start time was specified as a whole day event end , or null if event has no duration Gets a value indicating whether this instance is end all day. true if end time was specified as a whole day location organizer attendees description latitude longitude Parses a string as a date. RFC 2445 allows the start and end fields to be of type DATE (e.g. 20081021) or DATE-TIME (e.g. 20081021T123000 for local time, or 20081021T123000Z for UTC). The string to parse if not a date formatted string Represents a parsed result that encodes an email message including recipients, subject and body text. Sean Owen the email address the TOs the CCs the BCCs the subject the body the mailto: uri Represents a result that encodes an e-mail address, either as a plain address like "joe@example.org" or a mailto: URL like "mailto:joe@example.org". Sean Owen Implements the "MATMSG" email message entry format. Supported keys: TO, SUB, BODY Sean Owen This implements only the most basic checking for an email address's validity -- that it contains an '@' and contains no characters disallowed by RFC 2822. This is an overly lenient definition of validity. We want to generally be lenient here since this class is only intended to encapsulate what's in a barcode, not "judge" it. The email. true if it is basically a valid email address; otherwise, false. Represents a parsed result that encodes extended product information as encoded by the RSS format, like weight, price, dates, etc. Antonio Manuel Benjumea Conde, Servinform, S.A. Agustín Delgado, Servinform, S.A. extension for kilogram weight type extension for pounds weight type initializing constructor the raw text the product id the sscc the lot number the production date the packaging date the best before date the expiration date the weight the weight type the weight increment the price the price increment the price currency the uncommon AIs the display representation (raw text) Parses strings of digits that represent a RSS Extended code. Antonio Manuel Benjumea Conde, Servinform, S.A. Agustín Delgado, Servinform, S.A. tries to parse a text representation to a specific result object Represents a parsed result that encodes a geographic coordinate, with latitude, longitude and altitude. Sean Owen latitude in degrees longitude in degrees altitude in meters. If not specified, in the geo URI, returns 0.0 query string associated with geo URI or null if none exists the geo URI a URI link to Google Maps which display the point on the Earth described by this instance, and sets the zoom level in a way that roughly reflects the altitude, if specified Parses a "geo:" URI result, which specifies a location on the surface of the Earth as well as an optional altitude above the surface. See http://tools.ietf.org/html/draft-mayrhofer-geo-uri-00. Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source Represents a parsed result that encodes a product ISBN number. jbreiden@google.com (Jeff Breidenbach) the ISBN number Parses strings of digits that represent a ISBN. jbreiden@google.com (Jeff Breidenbach) www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source See ISBN-13 For Dummies The result.

Abstract class representing the result of decoding a barcode, as more than a String -- as some type of structured data. This might be a subclass which represents a URL, or an e-mail address. {@link ResultParser#parseResult(Result)} will turn a raw decoded string into the most appropriate type of structured representation.

Thanks to Jeff Griffin for proposing rewrite of these classes that relies less on exception-based mechanisms during parsing.

Sean Owen
user friendly value gets the type of the parsed result user friendly value constructor gets a user friendly value compare two objects gets the hashcode append to result if not null or empty append to result if not null or empty Represents the type of data encoded by a barcode -- from plain text, to a URI, to an e-mail address, etc. Sean Owen address book email address product URI Text geo coordinates telefon sms calendar wifi ISBN VIN Represents a parsed result that encodes a product by an identifier of some kind. dswitkin@google.com (Daniel Switkin) product id normalized product id Parses strings of digits that represent a UPC code. dswitkin@google.com (Daniel Switkin)

Abstract class representing the result of decoding a barcode, as more than a String -- as some type of structured data. This might be a subclass which represents a URL, or an e-mail address. {@link #parseResult(com.google.zxing.Result)} will turn a raw decoded string into the most appropriate type of structured representation.

Thanks to Jeff Griffin for proposing rewrite of these classes that relies less on exception-based mechanisms during parsing.

Sean Owen
Attempts to parse the raw {@link Result}'s contents as a particular type of information (email, URL, etc.) and return a {@link ParsedResult} encapsulating the result of parsing. the raw to parse encapsulating the parsing result Parses the result. The result. append value to result, if not null append value to result, if not null wrap, if not null unescape backslash parse hex digit decodes url

Parses an "sms:" URI result, which specifies a number to SMS and optional "via" number. See the IETF draft on this.

This actually also parses URIs starting with "mms:", "smsto:", "mmsto:", "SMSTO:", and "MMSTO:", and treats them all the same way, and effectively converts them to an "sms:" URI for purposes of forwarding to the platform.

Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source
Represents a parsed result that encodes an SMS message, including recipients, subject and body text. Sean Owen initializing constructor initializing constructor numbers vias subject body sms uri

Parses an "smsto:" URI result, whose format is not standardized but appears to be like: {@code smsto:number(:body)}.

This actually also parses URIs starting with "smsto:", "mmsto:", "SMSTO:", and "MMSTO:", and treats them all the same way, and effectively converts them to an "sms:" URI for purposes of forwarding to the platform.

Sean Owen
attempt to parse the raw result to the specific type

Parses an "smtp:" URI result, whose format is not standardized but appears to be like: smtp[:subject[:body]]}.

See http://code.google.com/p/zxing/issues/detail?id=536

Sean Owen
attempt to parse the raw result to the specific type Represents a parsed result that encodes a telephone number. Sean Owen initializing constructor number URI title Parses a "tel:" URI result, which specifies a phone number. Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source A simple result type encapsulating a string that has no further interpretation. Sean Owen initializing constructor text language A simple result type encapsulating a URI that has no further interpretation. Sean Owen URI title true if the URI contains suspicious patterns that may suggest it intends to mislead the user about its true nature. At the moment this looks for the presence of user/password syntax in the host/authority portion of a URI which may be used in attempts to make the URI's host appear to be other than it is. Example: http://yourbank.com@phisher.com This URI connects to phisher.com but may appear to connect to yourbank.com at first glance. initializing constructor Transforms a string that represents a URI into something more proper, by adding or canonicalizing the protocol. Tries to parse results that are a URI of some kind. Sean Owen @return true if the URI contains suspicious patterns that may suggest it intends to mislead the user about its true nature. At the moment this looks for the presence of user/password syntax in the host/authority portion of a URI which may be used in attempts to make the URI's host appear to be other than it is. Example: http://yourbank.com@phisher.com This URI connects to phisher.com but may appear to connect to yourbank.com at first glance. Parses the "URLTO" result format, which is of the form "URLTO:[title]:[url]". This seems to be used sometimes, but I am not able to find documentation on its origin or official format? Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source Parses contact information formatted according to the VCard (2.1) format. This is not a complete implementation but should parse information as commonly encoded in 2D barcodes. Sean Owen Formats name fields of the form "Public;John;Q.;Reverend;III" into a form like "Reverend John Q. Public III". @param names name values to format, in place Partially implements the iCalendar format's "VEVENT" format for specifying a calendar event. See RFC 2445. This supports SUMMARY, DTSTART and DTEND fields. Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source Represents a parsed result that encodes a Vehicle Identification Number (VIN). VIN manufacturer id vehicle descriptor section vehicle identifier section country code vehicle attributes model year plant code sequential number initializing constructor a user friendly representation Detects a result that is likely a vehicle identification number. @author Sean Owen attempt to parse the raw result to the specific type Represents a parsed result that encodes wifi network information, like SSID and password. Vikram Aggarwal initializing constructor initializing constructor initializing constructor SSID network encryption password hidden flag identity anonymous eap phase 2 method

Parses a WIFI configuration string. Strings will be of the form:

{@code WIFI:T:[network type];S:[network SSID];P:[network password];H:[hidden?];;}

The fields can appear in any order. Only "S:" is required.

For WPA2 enterprise(EAP), strings will be of the form:

{@code WIFI:T:WPA2-EAP;S:[network SSID];H:[hidden?];E:[EAP method];PH2:[Phase 2 method];A:[anonymous identity];I:[username];P:[password];;}

"EAP method" can e.g.be "TTLS" or "PWD" or one of the other fields in WifiEnterpriseConfig.Eap and "Phase 2 method" can e.g.be "MSCHAPV2" or any of the other fields in WifiEnterpriseConfig.Phase2

Vikram Aggarwal Sean Owen Steffen Kieß
attempt to parse the raw result to the specific type A simple, fast array of bits, represented compactly by an array of ints internally. Sean Owen size of the array, number of elements size of the array in bytes index accessor default constructor initializing constructor desired size of the array Flips bit i. bit to set Gets the next set. first bit to check index of first bit that is set, starting from the given index, or size if none are set at or beyond this given index see getNextSet(int) index to start looking for unset bit index of next unset bit, or if none are unset until the end Sets a block of 32 bits, starting at bit i. first bit to set the new value of the next 32 bits. Note again that the least-significant bit corresponds to bit i, the next-least-significant to i+1, and so on. Sets a range of bits. start of range, inclusive. end of range, exclusive Clears all bits (sets to false). Efficient method to check if a range of bits is set, or not set. start of range, inclusive. end of range, exclusive if true, checks that bits in range are set, otherwise checks that they are not set true iff all bits are set or not set in range, according to value argument if end is less than start or the range is not contained in the array Appends the bit. The bit. underlying array of ints. The first element holds the first 32 bits, and the least significant bit is bit 0. Appends the least-significant bits, from value, in order from most-significant to least-significant. For example, appending 6 bits from 0x000001E will append the bits 0, 1, 1, 1, 1, 0 in that order. containing bits to append bits from value to append adds the array to the end XOR operation converts to bytes. first bit to start writing array to write into. Bytes are written most-significant byte first. This is the opposite of the internal representation, which is exposed by BitArray position in array to start writing how many bytes to write Reverses all bits in the array. Determines whether the specified is equal to this instance. The to compare with this instance. true if the specified is equal to this instance; otherwise, false. Returns a hash code for this instance. A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. Returns a that represents this instance. A that represents this instance. Erstellt ein neues Objekt, das eine Kopie der aktuellen Instanz darstellt. Ein neues Objekt, das eine Kopie dieser Instanz darstellt.

Represents a 2D matrix of bits. In function arguments below, and throughout the common module, x is the column position, and y is the row position. The ordering is always x, y. The origin is at the top-left.

Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins with a new int. This is done intentionally so that we can copy out a row into a very efficiently.

The ordering of bits is row-major. Within each int, the least significant bits are used first, meaning they represent lower x values. This is compatible with 's implementation.

Sean Owen dswitkin@google.com (Daniel Switkin)
The width of the matrix The height of the matrix This method is for compatibility with older code. It's only logical to call if the matrix is square, so I'm throwing if that's not the case. row/column dimension of this matrix The rowsize of the matrix Creates an empty square . height and width Creates an empty square . bit matrix width bit matrix height Interprets a 2D array of booleans as a , where "true" means an "on" bit. bits of the image, as a row-major 2D array. Elements are arrays representing rows representation of image parse the string representation to a bitmatrix

Gets the requested bit, where true means black.

The horizontal component (i.e. which column) The vertical component (i.e. which row) value of given bit in matrix

Flips the given bit.

The horizontal component (i.e. which column) The vertical component (i.e. which row)

Flips every bit in the matrix.

flip all of the bits, if shouldBeFlipped is true for the coordinates should return true, if the bit at a given coordinate should be flipped Exclusive-or (XOR): Flip the bit in this {@code BitMatrix} if the corresponding mask bit is set. The mask. Clears all bits (sets to false).

Sets a square region of the bit matrix to true.

The horizontal position to begin at (inclusive) The vertical position to begin at (inclusive) The width of the region The height of the region
A fast method to retrieve one row of data from the matrix as a BitArray. The row to retrieve An optional caller-allocated BitArray, will be allocated if null or too small The resulting BitArray - this reference should always be used even when passing your own row Sets the row. row to set {@link BitArray} to copy from Modifies this {@code BitMatrix} to represent the same but rotated the given degrees(0, 90, 180, 270) number of degrees to rotate through counter-clockwise(0, 90, 180, 270) Modifies this {@code BitMatrix} to represent the same but rotated 180 degrees Modifies this {@code BitMatrix} to represent the same but rotated 90 degrees counterclockwise This is useful in detecting the enclosing rectangle of a 'pure' barcode. {left,top,width,height} enclosing rectangle of all 1 bits, or null if it is all white This is useful in detecting a corner of a 'pure' barcode. {x,y} coordinate of top-left-most 1 bit, or null if it is all white bottom right Determines whether the specified is equal to this instance. The to compare with this instance. true if the specified is equal to this instance; otherwise, false. Returns a hash code for this instance. A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. Returns a that represents this instance. A that represents this instance. Returns a that represents this instance. The set string. The unset string. A that represents this instance. Returns a that represents this instance. The set string. The unset string. The line separator. A that represents this instance. Clones this instance.

This provides an easy abstraction to read bits at a time from a sequence of bytes, where the number of bits read is not often a multiple of 8.

This class is thread-safe but not reentrant. Unless the caller modifies the bytes array it passed in, in which case all bets are off.

Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source
bytes from which this will read bits. Bits will be read from the first byte first. Bits are read within a byte from most-significant to least-significant bit. index of next bit in current byte which would be read by the next call to {@link #readBits(int)}. index of next byte in input byte array which would be read by the next call to {@link #readBits(int)}. number of bits to read int representing the bits read. The bits will appear as the least-significant bits of the int if numBits isn't in [1,32] or more than is available number of bits that can be read successfully Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1 of ISO 18004. Sean Owen encoding name character set ECI value representing ECI of given value, or null if it is legal but unsupported character set ECI encoding name representing ECI for character encoding, or null if it is legal but unsupported encoding CharacterSetECI representing ECI for character encoding, or null if it is legal but unsupported returns the encoding object fo the specified charset returns the encoding object fo the specified name Encapsulates the result of decoding a matrix of bits. This typically applies to 2D barcode formats. For now it contains the raw bytes obtained, as well as a String interpretation of those bytes, if applicable. Sean Owen raw bytes representing the result, or null if not applicable how many bits of are valid; typically 8 times its length text representation of the result list of byte segments in the result, or null if not applicable name of error correction level used, or null if not applicable gets a value which describe if structure append data was found number of errors corrected, or null if not applicable gives the sequence number of the result if structured append was found number of erasures corrected, or null if not applicable gives the parity information if structured append was found Miscellanseous data value for the various decoders The other. gives the symbology identifier initializing constructor initializing constructor initializing constructor initializing constructor initializing constructor initializing constructor Defines an container for encoder options Gets the data container for all options event is raised when a value is changed Gets or sets a flag which cause a deeper look into the bitmap true if [try harder]; otherwise, false. Gets or sets a value indicating whether the image should be automatically inverted if no result is found in the original image. ATTENTION: Please be carefully because it slows down the decoding process if it is used true if image should be inverted; otherwise, false. Image is a pure monochrome image of a barcode. true if monochrome image of a barcode; otherwise, false. Specifies what character encoding to use when decoding, where applicable (type String) The character set. Image is known to be of one of a few possible formats. Maps to a {@link java.util.List} of {@link BarcodeFormat}s. The possible formats. if Code39 could be detected try to use extended mode for full ASCII character set Don't fail if a Code39 is detected but can't be decoded in extended mode. Return the raw Code39 result instead. Maps to . Assume Code 39 codes employ a check digit. Maps to . true if it should assume a Code 39 check digit; otherwise, false. If true, return the start and end digits in a Codabar barcode instead of stripping them. They are alpha, whereas the rest are numeric. By default, they are stripped, but this causes them to not be. Doesn't matter what it maps to; use . Assume the barcode is being processed as a GS1 barcode, and modify behavior as needed. For example this affects FNC1 handling for Code 128 (aka GS1-128). true if it should assume GS1; otherwise, false. Assume MSI codes employ a check digit. Maps to . true if it should assume a MSI check digit; otherwise, false. Allowed lengths of encoded data -- reject anything else. Maps to an int[]. Allowed extension lengths for EAN or UPC barcodes. Other formats will ignore this. Maps to an int[] of the allowed extension lengths, for example [2], [5], or [2, 5]. If it is optional to have an extension, do not set this hint. If this is set, and a UPC or EAN barcode is found but an extension is not, then no result will be returned at all. Initializes a new instance of the class. Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source

Encapsulates the result of detecting a barcode in an image. This includes the raw matrix of black/white pixels corresponding to the barcode, and possibly points of interest in the image, like the location of finder patterns or corners of the barcode in the image.

Sean Owen
the detected bits the pixel points where the result is found initializing constructor General math-related and numeric utility functions. Ends up being a bit faster than {@link Math#round(float)}. This merely rounds its argument to the nearest int, where x.5 rounds up to x+1. Semantics of this shortcut differ slightly from {@link Math#round(float)} in that half rounds down for negative values. -2.5 rounds to -3, not -2. For purposes here it makes no difference. real value to round nearest int Euclidean distance between points A and B Euclidean distance between points A and B values to sum sum of values in array

A somewhat generic detector that looks for a barcode-like rectangular region within an image. It looks within a mostly white region of an image for a region of black and white, but mostly black. It returns the four corners of the region, as best it can determine.

Sean Owen
initializing constructor

Detects a rectangular region of black and white -- mostly black -- with a region of mostly white, in an image.

[] describing the corners of the rectangular region. The first and last points are opposed on the diagonal, as are the second and third. The first point will be the topmost point and the last, the bottommost. The second point will be leftmost and the third, the rightmost
Attempts to locate a corner of the barcode by scanning up, down, left or right from a center point which should be within the barcode. center's x component (horizontal) same as deltaY but change in x per step instead minimum value of x maximum value of x center's y component (vertical) change in y per step. If scanning up this is negative; down, positive; left or right, 0 minimum value of y to search through (meaningless when di == 0) maximum value of y maximum run of white pixels that can still be considered to be within the barcode a encapsulating the corner that was found Computes the start and end of a region of pixels, either horizontally or vertically, that could be part of a Data Matrix barcode. if scanning horizontally, this is the row (the fixed vertical location) where we are scanning. If scanning vertically it's the column, the fixed horizontal location largest run of white pixels that can still be considered part of the barcode region minimum pixel location, horizontally or vertically, to consider maximum pixel location, horizontally or vertically, to consider if true, we're scanning left-right, instead of up-down int[] with start and end of found range, or null if no such range is found (e.g. only white was found) Detects a candidate barcode-like rectangular region within an image. It starts around the center of the image, increases the size of the candidate region until it finds a white rectangular region. By keeping track of the last black points it encountered, it determines the corners of the barcode. David Olivier Creates a WhiteRectangleDetector instance The image. null, if image is too small, otherwise a WhiteRectangleDetector instance Creates a WhiteRectangleDetector instance barcode image to find a rectangle in initial size of search area around center x position of search center y position of search center null, if image is too small, otherwise a WhiteRectangleDetector instance Initializes a new instance of the class. The image. if image is too small Initializes a new instance of the class. The image. Size of the init. The x. The y. Detects a candidate barcode-like rectangular region within an image. It starts around the center of the image, increases the size of the candidate region until it finds a white rectangular region. [] describing the corners of the rectangular region. The first and last points are opposed on the diagonal, as are the second and third. The first point will be the topmost point and the last, the bottommost. The second point will be leftmost and the third, the rightmost recenters the points of a constant distance towards the center bottom most point left most point right most point top most point [] describing the corners of the rectangular region. The first and last points are opposed on the diagonal, as are the second and third. The first point will be the topmost point and the last, the bottommost. The second point will be leftmost and the third, the rightmost Determines whether a segment contains a black point min value of the scanned coordinate max value of the scanned coordinate value of fixed coordinate set to true if scan must be horizontal, false if vertical true if a black point has been found, else false. Superclass of classes encapsulating types ECIs, according to "Extended Channel Interpretations" 5.3 of ISO 18004. Sean Owen the ECI value ECI value representing ECI of given value, or null if it is legal but unsupported ArgumentException if ECI value is invalid Set of CharsetEncoders for a given input string Invariants: - The list contains only encoders from CharacterSetECI(list is shorter then the list of encoders available on the platform for which ECI values are defined). - The list contains encoders at least one encoder for every character in the input. - The first encoder in the list is always the ISO-8859-1 encoder even of no character in the input can be encoded by it. - If the input contains a character that is not in ISO-8859-1 then the last two entries in the list will be the UTF-8 encoder and the UTF-16BE encoder. @author Alex Geller Constructs an encoder set the string that needs to be encoded The preferred { @link Charset } or null. fnc1 denotes the character in the input that represents the FNC1 character or -1 for a non-GS1 bar code.When specified, it is considered an error to pass it as argument to the methods canEncode() or encode(). returns -1 if no priority charset was defined -1 if no priority charset was defined Interface to navigate a sequence of ECIs and bytes. @author Alex Geller Returns the length of this input.The length is the number of {@code byte}s in or ECIs in the sequence. Returns the {@code byte} value at the specified index. An index ranges from zero to {@code length() - 1}. The first { @code byte} value of the sequence is at index zero, the next at index one, and so on, as for array indexing. the index of the {@code byte} value to be returned the specified {@code byte} value as character or the FNC1 character if the {@code index} argument is negative or not less than {@code Length} if the value at the {@code index} argument is an ECI (@see #isECI) Returns a {@code CharSequence} that is a subsequence of this sequence. The subsequence starts with the {@code char} value at the specified index and ends with the {@code char} value at index {@code end - 1}. The length (in {@code char}s) of the returned sequence is {@code end - start}, so if {@code start == end} then an empty sequence is returned. the start index, inclusive the start index, inclusive the specified subsequence if {@code start} or {@code end} are negative, if {@code end} is greater than { @code length()}, or if {@code start} is greater than { @code end} if a value in the range {@code start}-{@code end} is an ECI (@see #isECI) Determines if a value is an ECI the index of the value true if the value at position {@code index} is an ECI if the {@code index} argument is negative or not less than {@code length()} Returns the {@code int} ECI value at the specified index. An index ranges from zero to {@code length() - 1}. The first {@code byte} value of the sequence is at index zero, the next at index one, and so on, as for array indexing. the index of the {@code int} value to be returned the specified {@code int} ECI value. The ECI specified the encoding of all bytes with a higher index until the next ECI or until the end of the input if no other ECI follows. if the value at the {@code index} argument is not an ECI (@see #isECI) Class that converts a sequence of ECIs and bytes into a string @author Alex Geller Appends {@code value} as a byte value character whose lowest byte is to be appended Appends {@code value} as a byte value byte to append Appends the characters in {@code value} as bytes values string to append Append the string repesentation of {@code value} (short for {@code append(String.valueOf(value))}) int to append as a string Appends ECI value to output. ECI value to append, as an int Appends the characters from {@code value} (unlike all other append methods of this class who append bytes) characters to append Short for {@code toString().length()} (if possible, use {@link #isEmpty()} instead) length of string representation in characters true if nothing has been appended Defines an container for encoder options Gets the data container for all options Specifies the height of the barcode image Specifies the width of the barcode image Don't put the content string into the output image. Specifies margin, in pixels, to use when generating the barcode. The meaning can vary by format; for example it controls margin before and after the barcode horizontally for most 1D formats. Specifies whether the data should be encoded to the GS1 standard; FNC1 character is added in front of the data Don't add a white area around the generated barcode if the requested size is larger than then barcode. Initializes a new instance of the class. This Binarizer implementation uses the old ZXing global histogram approach. It is suitable for low-end mobile devices which don't have enough CPU or memory to use a local thresholding algorithm. However, because it picks a global black point, it cannot handle difficult shadows and gradients. Faster mobile devices and all desktop applications should probably use HybridBinarizer instead. dswitkin@google.com (Daniel Switkin) Sean Owen Initializes a new instance of the class. The source. Applies simple sharpening to the row data to improve performance of the 1D Readers. Does not sharpen the data, as this call is intended to only be used by 2D Readers. Creates a new object with the same type as this Binarizer implementation, but with pristine state. This is needed because Binarizer implementations may be stateful, e.g. keeping a cache of 1 bit data. See Effective Java for why we can't use Java's clone() method. The LuminanceSource this Binarizer will operate on. A new concrete Binarizer implementation object. Implementations of this class can, given locations of finder patterns for a QR code in an image, sample the right points in the image to reconstruct the QR code, accounting for perspective distortion. It is abstracted since it is relatively expensive and should be allowed to take advantage of platform-specific optimized implementations, like Sun's Java Advanced Imaging library, but which may not be available in other environments such as J2ME, and vice versa. The implementation used can be controlled by calling {@link #setGridSampler(GridSampler)} with an instance of a class which implements this interface. Sean Owen the current implementation of Sets the implementation of used by the library. One global instance is stored, which may sound problematic. But, the implementation provided ought to be appropriate for the entire platform, and all uses of this library in the whole lifetime of the JVM. For instance, an Android activity can swap in an implementation that takes advantage of native platform libraries. The platform-specific object to install.

Samples an image for a square matrix of bits of the given dimension. This is used to extract the black/white modules of a 2D barcode like a QR Code found in an image. Because this barcode may be rotated or perspective-distorted, the caller supplies four points in the source image that define known points in the barcode, so that the image may be sampled appropriately.

The last eight "from" parameters are four X/Y coordinate pairs of locations of points in the image that define some significant points in the image to be sample. For example, these may be the location of finder pattern in a QR Code.

The first eight "to" parameters are four X/Y coordinate pairs measured in the destination , from the top left, where the known points in the image given by the "from" parameters map to.

These 16 parameters define the transformation needed to sample the image.

image to sample The dimension X. The dimension Y. The p1 preimage X. The p1 preimage Y. The p2 preimage X. The p2 preimage Y. The p3 preimage X. The p3 preimage Y. The p4 preimage X. The p4 preimage Y. The p1 image X. The p1 image Y. The p2 image X. The p2 image Y. The p3 image X. The p3 image Y. The p4 image X. The p4 image Y. representing a grid of points sampled from the image within a region defined by the "from" parameters ReaderException if image can't be sampled, for example, if the transformation defined

Checks a set of points that have been transformed to sample points on an image against the image's dimensions to see if the point are even within the image.

This method will actually "nudge" the endpoints back onto the image if they are found to be barely (less than 1 pixel) off the image. This accounts for imperfect detection of finder patterns in an image where the QR Code runs all the way to the image border.

For efficiency, the method will check points from either end of the line until one is found to be within the image. Because the set of points are assumed to be linear, this is valid.

image into which the points should map actual points in x1,y1,...,xn,yn form
This class implements a local thresholding algorithm, which while slower than the GlobalHistogramBinarizer, is fairly efficient for what it does. It is designed for high frequency images of barcodes with black data on white backgrounds. For this application, it does a much better job than a global blackpoint with severe shadows and gradients. However it tends to produce artifacts on lower frequency images and is therefore not a good general purpose binarizer for uses outside ZXing. This class extends GlobalHistogramBinarizer, using the older histogram approach for 1D readers, and the newer local approach for 2D readers. 1D decoding using a per-row histogram is already inherently local, and only fails for horizontal gradients. We can revisit that problem later, but for now it was not a win to use local blocks for 1D. This Binarizer is the default for the unit tests and the recommended class for library users. dswitkin@google.com (Daniel Switkin) gives the black matrix initializing constructor creates a new instance Calculates the final BitMatrix once for all requests. This could be called once from the constructor instead, but there are some advantages to doing it lazily, such as making profiling easier, and not doing heavy lifting when callers don't expect it. For each 8x8 block in the image, calculate the average black point using a 5x5 grid of the blocks around it. Also handles the corner cases (fractional blocks are computed based on the last 8 pixels in the row/column which are also used in the previous block). The luminances. Width of the sub. Height of the sub. The width. The height. The black points. The matrix. Applies a single threshold to an 8x8 block of pixels. The luminances. The xoffset. The yoffset. The threshold. The stride. The matrix. Calculates a single black point for each 8x8 block of pixels and saves it away. See the following thread for a discussion of this algorithm: http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0 The luminances. Width of the sub. Height of the sub. The width. The height. Class that converts a character string into a sequence of ECIs and bytes The implementation uses the Dijkstra algorithm to produce minimal encodings @author Alex Geller Constructs a minimal input the character string to encode The preferred {@link Charset}. When the value of the argument is null, the algorithm chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority charset to encode any character in the input that can be encoded by it if the charset is among the supported charsets. denotes the character in the input that represents the FNC1 character or -1 if this is not GS1 input. Returns the length of this input. The length is the number of {@code byte}s, FNC1 characters or ECIs in the sequence. Returns the {@code byte} value at the specified index. An index ranges from zero to {@code length() - 1}. The first {@code byte} value of the sequence is at index zero, the next at index one, and so on, as for array indexing. the index of the {@code byte} value to be returned the specified {@code byte} value as character or the FNC1 character if the {@code index} argument is negative or not less than {@code length()} if the value at the {@code index} argument is an ECI (@see #isECI) Returns a {@code CharSequence} that is a subsequence of this sequence. The subsequence starts with the {@code char} value at the specified index and ends with the {@code char} value at index {@code end - 1}. The length (in {@code char}s) of the returned sequence is {@code end - start}, so if {@code start == end} then an empty sequence is returned. the start index, inclusive the end index, exclusive the specified subsequence if {@code start} or {@code end} are negative, if {@code end} is greater than {@code length()}, or if {@code start} is greater than {@code end} if a value in the range {@code start}-{@code end} is an ECI (@see #isECI) Determines if a value is an ECI the index of the value true if the value at position {@code index} is an ECI if the {@code index} argument is negative or not less than {@code length()} Determines if a value is the FNC1 character the index of the value true if the value at position {@code index} is the FNC1 character if the {@code index} argument is negative or not less than {@code length()} Returns the {@code int} ECI value at the specified index. An index ranges from zero to {@code length() - 1}. The first {@code byte} value of the sequence is at index zero, the next at index one, and so on, as for array indexing. the index of the {@code int} value to be returned the specified {@code int} ECI value. The ECI specified the encoding of all bytes with a higher index until the next ECI or until the end of the input if no other ECI follows. if the {@code index} argument is negative or not less than {@code length()} if the value at the {@code index} argument is not an ECI (@see #isECI)

This class implements a perspective transform in two dimensions. Given four source and four destination points, it will compute the transformation implied between them. The code is based directly upon section 3.4.2 of George Wolberg's "Digital Image Warping"; see pages 54-56.

Sean Owen
Convenience method, not optimized for performance.

This class contains utility methods for performing mathematical operations over the Galois Fields. Operations use a given primitive polynomial in calculations.

Throughout this package, elements of the GF are represented as an {@code int} for convenience and speed (but at the cost of memory).

Sean Owen
Aztec data 12 Aztec data 10 Aztec data 6 Aztec param QR Code Data Matrix Aztec data 8 Maxicode Create a representation of GF(size) using the given primitive polynomial. irreducible polynomial whose coefficients are represented by * the bits of an int, where the least-significant bit represents the constant * coefficient the size of the field the factor b in the generator polynomial can be 0- or 1-based * (g(x) = (x+a^b)(x+a^(b+1))...(x+a^(b+2t-1))). * In most cases it should be 1, but for QR code it is 0. Builds the monomial. The degree. The coefficient. the monomial representing coefficient * x^degree Implements both addition and subtraction -- they are the same in GF(size). sum/difference of a and b Exps the specified a. 2 to the power of a in GF(size) Logs the specified a. A. base 2 log of a in GF(size) Inverses the specified a. multiplicative inverse of a Multiplies the specified a with b. A. The b. product of a and b in GF(size) Gets the size. Gets the generator base. Returns a that represents this instance. A that represents this instance.

Represents a polynomial whose coefficients are elements of a GF. Instances of this class are immutable.

Much credit is due to William Rucklidge since portions of this code are an indirect port of his C++ Reed-Solomon implementation.

Sean Owen
Initializes a new instance of the class. the {@link GenericGF} instance representing the field to use to perform computations coefficients as ints representing elements of GF(size), arranged from most significant (highest-power term) coefficient to least significant if argument is null or empty, or if leading coefficient is 0 and this is not a constant polynomial (that is, it is not the monomial "0") degree of this polynomial Gets a value indicating whether this is zero. true iff this polynomial is the monomial "0" coefficient of x^degree term in this polynomial The degree. coefficient of x^degree term in this polynomial evaluation of this polynomial at a given point A. evaluation of this polynomial at a given point

Implements Reed-Solomon decoding, as the name implies.

The algorithm will not be explained here, but the following references were helpful in creating this implementation:

Much credit is due to William Rucklidge since portions of this code are an indirect port of his C++ Reed-Solomon implementation.

Sean Owen William Rucklidge sanfordsquires
constructor

Decodes given set of received codewords, which include both data and error-correction codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place, in the input.

data and error-correction codewords number of error-correction codewords available false: decoding fails
Implements Reed-Solomon encoding, as the name implies. Sean Owen William Rucklidge constructor encodes Common string-related functions. Sean Owen Alex Dupre default encoding of the current platform (name) default encoding of the current platform (type) Shift JIS encoding if available GB 2312 encoding if available ECU JP encoding if available ISO8859-1 encoding if available SJIS GB2312 EUC-JP UTF-8 ISO-8859-1 Guesses the encoding. bytes encoding a string, whose encoding should be guessed decode hints if applicable name of guessed encoding; at the moment will only guess one of: "SJIS", "UTF8", "ISO8859_1", or the platform default encoding if none of these can possibly be correct bytes encoding a string, whose encoding should be guessed decode hints if applicable Charset of guessed encoding; at the moment will only guess one of: {@link #SHIFT_JIS_CHARSET}, {@link StandardCharsets#UTF_8}, {@link StandardCharsets#ISO_8859_1}, {@link StandardCharsets#UTF_16}, or the platform default encoding if none of these can possibly be correct This implementation can detect and decode Data Matrix codes in an image. bbrown@google.com (Brian Brown) Locates and decodes a Data Matrix code in an image. a String representing the content encoded by the Data Matrix code Locates and decodes a Data Matrix code in an image. a String representing the content encoded by the Data Matrix code does nothing here This method detects a code in a "pure" image -- that is, pure monochrome image which contains only an unrotated, unskewed, image of a code, with some white border around it. This is a specialized method that works exceptionally fast in this special case. This object renders a Data Matrix code as a BitMatrix 2D array of greyscale values. dswitkin@google.com (Daniel Switkin) Guillaume Le Biller Added to zxing lib. encodes the content to a BitMatrix encodes the content to a BitMatrix Encode the given symbol info to a bit matrix. The DataMatrix placement. The symbol info to encode. The bit matrix generated. Convert the ByteMatrix to BitMatrix. The input matrix. The requested width of the image (in pixels) with the Datamatrix code The requested height of the image (in pixels) with the Datamatrix code The output matrix. bbrown@google.com (Brian Brown) to parse if dimension is < 8 or > 144 or not 0 mod 2

Creates the version object based on the dimension of the original bit matrix from the datamatrix code.

See ISO 16022:2006 Table 7 - ECC 200 symbol attributes

Original including alignment patterns encapsulating the Data Matrix Code's "version" if the dimensions of the mapping matrix are not valid Data Matrix dimensions.

Reads the bits in the representing the mapping matrix (No alignment patterns) in the correct order in order to reconstitute the codewords bytes contained within the Data Matrix Code.

bytes encoded within the Data Matrix Code if the exact number of bytes expected is not read

Reads a bit of the mapping matrix accounting for boundary wrapping.

Row to read in the mapping matrix Column to read in the mapping matrix Number of rows in the mapping matrix Number of columns in the mapping matrix value of the given bit in the mapping matrix

Reads the 8 bits of the standard Utah-shaped pattern.

See ISO 16022:2006, 5.8.1 Figure 6

Current row in the mapping matrix, anchored at the 8th bit (LSB) of the pattern Current column in the mapping matrix, anchored at the 8th bit (LSB) of the pattern Number of rows in the mapping matrix Number of columns in the mapping matrix byte from the utah shape

Reads the 8 bits of the special corner condition 1.

See ISO 16022:2006, Figure F.3

Number of rows in the mapping matrix Number of columns in the mapping matrix byte from the Corner condition 1

Reads the 8 bits of the special corner condition 2.

See ISO 16022:2006, Figure F.4

Number of rows in the mapping matrix Number of columns in the mapping matrix byte from the Corner condition 2

Reads the 8 bits of the special corner condition 3.

See ISO 16022:2006, Figure F.5

Number of rows in the mapping matrix Number of columns in the mapping matrix byte from the Corner condition 3

Reads the 8 bits of the special corner condition 4.

See ISO 16022:2006, Figure F.6

Number of rows in the mapping matrix Number of columns in the mapping matrix byte from the Corner condition 4

Extracts the data region from a that contains alignment patterns.

Original with alignment patterns BitMatrix that has the alignment patterns removed

Encapsulates a block of data within a Data Matrix Code. Data Matrix Codes may split their data into multiple blocks, each of which is a unit of data and error-correction codewords. Each is represented by an instance of this class.

bbrown@google.com (Brian Brown)

When Data Matrix Codes use multiple data blocks, they actually interleave the bytes of each of them. That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This method will separate the data into original blocks.

bytes as read directly from the Data Matrix Code version of the Data Matrix Code DataBlocks containing original bytes, "de-interleaved" from representation in the Data Matrix Code

Data Matrix Codes can encode text as bits in one of several modes, and can use multiple modes in one Data Matrix Code. This class decodes the bits back into text.

See ISO 16022:2006, 5.2.1 - 5.2.9.2

bbrown@google.com (Brian Brown) Sean Owen
See ISO 16022:2006, Annex C Table C.1 The C40 Basic Character Set (*'s used for placeholders for the shift values) See ISO 16022:2006, Annex C Table C.2 The Text Basic Character Set (*'s used for placeholders for the shift values) See ISO 16022:2006, 5.2.3 and Annex C, Table C.2 See ISO 16022:2006, 5.2.5 and Annex C, Table C.1 See ISO 16022:2006, 5.2.6 and Annex C, Table C.2 See ISO 16022:2006, 5.2.7 See ISO 16022:2006, 5.2.8 and Annex C Table C.3 See ISO 16022:2006, 5.2.9 and Annex B, B.2 See ISO 16022:2007, 5.4.1 See ISO 16022:2006, Annex B, B.2

The main class which implements Data Matrix Code decoding -- as opposed to locating and extracting the Data Matrix Code from an image.

bbrown@google.com (Brian Brown)
Initializes a new instance of the class.

Convenience method that can decode a Data Matrix Code represented as a 2D array of booleans. "true" is taken to mean a black module.

booleans representing white/black Data Matrix Code modules text and bytes encoded within the Data Matrix Code if the Data Matrix Code cannot be decoded

Decodes a Data Matrix Code represented as a . A 1 or "true" is taken to mean a black module.

booleans representing white/black Data Matrix Code modules text and bytes encoded within the Data Matrix Code

Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place using Reed-Solomon error correction.

data and error correction codewords number of codewords that are data bytes
The Version object encapsulates attributes about a particular size Data Matrix Code. bbrown@google.com (Brian Brown) returns the version numer returns the symbol size rows returns the symbols size columns retursn the data region size rows returns the data region size columns returns the total codewords count

Deduces version information from Data Matrix dimensions.

Number of rows in modules Number of columns in modules Version for a Data Matrix Code of those dimensions if dimensions do correspond to a valid Data Matrix size

Encapsulates a set of error-correction blocks in one symbol version. Most versions will use blocks of differing sizes within one version, so, this encapsulates the parameters for each set of blocks. It also holds the number of error-correction codewords per block since it will be the same across all blocks within one version.

Encapsulates the parameters for one error-correction block in one symbol version. This includes the number of data codewords, and the number of times a block with these parameters is used consecutively in the Data Matrix code version's format.

returns the version number as string See ISO 16022:2006 5.5.1 Table 7

Encapsulates logic that can detect a Data Matrix Code in an image, even if the Data Matrix Code is rotated or skewed, or partially obscured.

Sean Owen
Initializes a new instance of the class. The image.

Detects a Data Matrix Code in an image.

encapsulating results of detecting a Data Matrix Code or null
Detect a solid side which has minimum transition. Detect a second solid side next to first solid side. Calculates the corner position of the white top right module. Shift the edge points to the module center. Counts the number of black/white transitions between two points, using something like Bresenham's algorithm. Handle "end of data" situations the encoder context the buffer with the remaining encoded characters Symbol Character Placement Program. Adapted from Annex M.1 in ISO/IEC 16022:2000(E). Main constructor the codewords to place the number of columns the number of rows num rows num cols bits get a specific bit place Places the 8 bits of a utah-shaped symbol character in ECC200. The row. The col. character position Handle "end of data" situations the encoder context the buffer with the remaining encoded characters Enumeration for encodation types ASCII C40 TEXT X12 EDIFACT BASE256 Error Correction Code for ECC200. Lookup table which factors to use for which number of error correction codewords. See FACTORS. Precomputed polynomial factors for ECC 200. Creates the ECC200 error correction for an encoded message. The codewords. information about the symbol to be encoded the codewords with interleaved error correction. DataMatrix ECC 200 data encoder following the algorithm described in ISO/IEC 16022:200(E) in annex S. Padding character mode latch to C40 encodation mode mode latch to Base 256 encodation mode FNC1 Codeword Structured Append Codeword Reader Programming Upper Shift 05 Macro 06 Macro mode latch to ANSI X.12 encodation mode mode latch to Text encodation mode mode latch to EDIFACT encodation mode ECI character (Extended Channel Interpretation) Unlatch from C40 encodation Unlatch from X12 encodation 05 Macro header 06 Macro header Macro trailer Performs message encoding of a DataMatrix message using the algorithm described in annex P of ISO/IEC 16022:2000(E). the message the encoded message (the char values range from 0 to 255) Performs message encoding of a DataMatrix message using the algorithm described in annex P of ISO/IEC 16022:2000(E). the message requested shape. May be {@code SymbolShapeHint.FORCE_NONE},{@code SymbolShapeHint.FORCE_SQUARE} or {@code SymbolShapeHint.FORCE_RECTANGLE}. the minimum symbol size constraint or null for no constraint the maximum symbol size constraint or null for no constraint encoding mode to start with the encoded message (the char values range from 0 to 255) Performs message encoding of a DataMatrix message using the algorithm described in annex P of ISO/IEC 16022:2000(E). the message requested shape. May be {@code SymbolShapeHint.FORCE_NONE},{@code SymbolShapeHint.FORCE_SQUARE} or {@code SymbolShapeHint.FORCE_RECTANGLE}. the minimum symbol size constraint or null for no constraint the maximum symbol size constraint or null for no constraint encoding mode to start with enforce C40 encoding the encoded message (the char values range from 0 to 255) Determines the number of consecutive characters that are encodable using numeric compaction. the message the start position within the message the requested character count Encoder that encodes minimally Algorithm: Uses Dijkstra to produce mathematically minimal encodings that are in some cases smaller than the results produced by the algorithm described in annex S in the specification ISO/IEC 16022:200(E). The biggest improvment of this algorithm over that one is the case when the algorithm enters the most inefficient mode, the B256 mode.The algorithm from the specification algorithm will exit this mode only if it encounters digits so that arbitrarily inefficient results can be produced if the postfix contains no digits. Multi ECI support and ECI switching: For multi language content the algorithm selects the most compact representation using ECI modes.Note that unlike the compaction algorithm used for QR-Codes, this implementation operates in two stages and therfore is not mathematically optimal.In the first stage, the input string is encoded minimally as a stream of ECI character set selectors and bytes encoded in the selected encoding.In this stage the algorithm might for example decide to encode ocurrences of the characters "\u0150\u015C" (O-double-acute, S-circumflex) in UTF-8 by a single ECI or alternatively by multiple ECIs that switch between IS0-8859-2 and ISO-8859-3 (e.g. in the case that the input contains many * characters from ISO-8859-2 (Latin 2) and few from ISO-8859-3 (Latin 3)). In a second stage this stream of ECIs and bytes is minimally encoded using the various Data Matrix encoding modes. While both stages encode mathematically minimally it is not ensured that the result is mathematically minimal since the size growth for inserting an ECI in the first stage can only be approximated as the first stage does not know in which mode the ECI will occur in the second stage(may, or may not require an extra latch to ASCII depending on the current mode). The reason for this shortcoming are difficulties in implementing it in a straightforward and readable manner. GS1 support FNC1 delimiters can be encoded in the input string by using the FNC1 character specified in the encoding function. When a FNC1 character is specified then a leading FNC1 will be encoded and all ocurrences of delimiter characters while result in FNC1 codewords in the symbol. @author Alex Geller Performs message encoding of a DataMatrix message @param msg the message @return the encoded message (the char values range from 0 to 255) Performs message encoding of a DataMatrix message @param msg the message @param priorityCharset The preferred {@link Charset}. When the value of the argument is null, the algorithm chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority charset to encode any character in the input that can be encoded by it if the charset is among the supported charsets. @param fnc1 denotes the character in the input that represents the FNC1 character or -1 if this is not a GS1 bar code. If the value is not -1 then a FNC1 is also prepended. @param shape requested shape. @return the encoded message (the char values range from 0 to 255) Encodes input minimally and returns an array of the codewords @param input The string to encode @param priorityCharset The preferred {@link Charset}. When the value of the argument is null, the algorithm chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority charset to encode any character in the input that can be encoded by it if the charset is among the supported charsets. @param fnc1 denotes the character in the input that represents the FNC1 character or -1 if this is not a GS1 bar code. If the value is not -1 then a FNC1 is also prepended. @param shape requested shape. @param macroId Prepends the specified macro function in case that a value of 5 or 6 is specified. @return An array of bytes representing the codewords of a minimal encoding. @return the number of words in which the string starting at from can be encoded in c40 or text mode. The number of characters encoded is returned in characterLength. The number of characters encoded is also minimal in the sense that the algorithm stops as soon as a character encoding fills a C40 word competely (three C40 values). An exception is at the end of the string where two C40 values are allowed (according to the spec the third c40 value is filled with 0 (Shift 1) in this case). Returns Mode.ASCII in case that: - Mode is EDIFACT and characterLength is less than 4 or the remaining characters can be encoded in at most 2 ASCII bytes. - Mode is C40, TEXT or X12 and the remaining characters can be encoded in at most 1 ASCII byte. Returns mode in all other cases. Peeks ahead and returns 1 if the postfix consists of exactly two digits, 2 if the postfix consists of exactly two consecutive digits and a non extended character or of 4 digits. Returns 0 in any other case Returns the capacity in codewords of the smallest symbol that has enough capacity to fit the given minimal number of codewords. Returns the remaining capacity in codewords of the smallest symbol that has enough capacity to fit the given minimal number of codewords. @return the size in bytes Symbol info table for DataMatrix. matrix width matrix height Overrides the symbol info set used by this class. Used for testing purposes. @param override the symbol info set to use initializing constructor symbol data width symbol data height symbol width symbol height codeword count interleaved block count data length for interleaved block error length for interleaved block user friendly representation Enumeration for DataMatrix symbol shape hint. It can be used to force square or rectangular symbols. doesn't force anything forces square image forces rectangle image The class holds the available options for the DatamatrixWriter Specifies the matrix shape for Data Matrix Specifies a minimum barcode size Specifies a maximum barcode size Specifies the default encodation Make sure that the content fits into the encodation value, otherwise there will be an exception thrown. standard value: Encodation.ASCII Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false" The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1 character set via ECIs. Please note that in that case, the most compact character encoding is chosen for characters in the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by means of the {@link #CHARACTER_SET} encoding hint. Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords for the purpose of delimiting AIs. Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive. Specifies what character encoding to use where applicable (type {@link String}) implements an Intelligent Mail barcode Rishabh Hatgadkar decode the image resets internal state

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode or null, if an error occurs or barcode cannot be found
mike32767 Manuel Kasten to parse

MaxiCodes can encode text or structured information as bits in one of several modes, with multiple character sets in one code. This class decodes the bits back into text.

mike32767 Manuel Kasten

The main class which implements MaxiCode decoding -- as opposed to locating and extracting the MaxiCode from an image.

Manuel Kasten
constructor decode the bits decode the bits This implementation can detect and decode a MaxiCode in an image. Locates and decodes a MaxiCode in an image. a String representing the content encoded by the MaxiCode if a MaxiCode cannot be decoded Locates and decodes a MaxiCode within an image. This method also accepts hints, each possibly associated to some data, which may help the implementation decode. image of barcode to decode passed as a from to arbitrary data. The meaning of the data depends upon the hint type. The implementation may or may not do anything with these hints. String which the barcode encodes does nothing here This method detects a code in a "pure" image -- that is, pure monochrome image which contains only an unrotated, unskewed, image of a code, with some white border around it. This is a specialized method that works exceptionally fast in this special case. This class attempts to decode a barcode from an image, not by scanning the whole image, but by scanning subsets of the image. This is important when there may be multiple barcodes in an image, and detecting a barcode may find parts of multiple barcode and fail to decode (e.g. QR Codes). Instead this scans the four quadrants of the image -- and also the center 'quadrant' to cover the case where a barcode is found in the center. Initializes a new instance of the class. The @delegate. Locates and decodes a barcode in some format within an image. image of barcode to decode String which the barcode encodes Locates and decodes a barcode in some format within an image. This method also accepts hints, each possibly associated to some data, which may help the implementation decode. image of barcode to decode passed as a from to arbitrary data. The meaning of the data depends upon the hint type. The implementation may or may not do anything with these hints. String which the barcode encodes Resets any internal state the implementation has after a decode, to prepare it for reuse.

Attempts to locate multiple barcodes in an image by repeatedly decoding portion of the image. After one barcode is found, the areas left, above, right and below the barcode's {@link com.google.zxing.ResultPoint}s are scanned, recursively.

A caller may want to also employ {@link ByQuadrantReader} when attempting to find multiple 2D barcodes, like QR Codes, in an image, where the presence of multiple barcodes might prevent detecting any one of them.

That is, instead of passing a {@link Reader} a caller might pass new ByQuadrantReader(reader).

Sean Owen
Initializes a new instance of the class. The @delegate. Decodes the multiple. The image. Decodes the multiple. The image. The hints. Locates and decodes a barcode in some format within an image. image of barcode to decode String which the barcode encodes Locates and decodes a barcode in some format within an image. This method also accepts hints, each possibly associated to some data, which may help the implementation decode. image of barcode to decode passed as a from to arbitrary data. The meaning of the data depends upon the hint type. The implementation may or may not do anything with these hints. String which the barcode encodes Resets any internal state the implementation has after a decode, to prepare it for reuse. Implementation of this interface attempt to read several barcodes from one image. Sean Owen Decodes the multiple. The image. Decodes the multiple. The image. The hints.

Encapsulates logic that can detect one or more QR Codes in an image, even if the QR Code is rotated or skewed, or partially obscured.

Sean Owen Hannes Erven
Initializes a new instance of the class. The image. Detects the multi. The hints.

This class attempts to find finder patterns in a QR Code. Finder patterns are the square markers at three corners of a QR Code.

This class is thread-safe but not reentrant. Each thread must allocate its own object.

In contrast to , this class will return an array of all possible QR code locations in the image.

Use the TRY_HARDER hint to ask for a more thorough detection.

Sean Owen Hannes Erven
More or less arbitrary cutoff point for determining if two finder patterns might belong to the same code if they differ less than DIFF_MODSIZE_CUTOFF_PERCENT percent in their estimated modules sizes. More or less arbitrary cutoff point for determining if two finder patterns might belong to the same code if they differ less than DIFF_MODSIZE_CUTOFF pixels/module in their estimated modules sizes. A comparator that orders FinderPatterns by their estimated module size.

Creates a finder that will search the image for three finder patterns.

image to search callback for result points
the 3 best s from our list of candidates. The "best" are those that have been detected at least CENTER_QUORUM times, and whose module size differs from the average among those patterns the least try to find patterns This implementation can detect and decode multiple QR Codes in an image. Decodes the multiple. The image. Decodes the multiple. The image. The hints.

Decodes Codabar barcodes.

Bas Vijfwinkel
These represent the encodings of characters, as patterns of wide and narrow bars. The 7 least-significant bits of each int correspond to the pattern of wide and narrow, with 1s representing "wide" and 0s representing narrow.

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode or null, if an error occurs or barcode cannot be found
Records the size of all runs of white and black pixels, starting with white. This is just like recordPattern, except it records all the counters, and uses our builtin "counters" member for storage. row to count from This class renders CodaBar as []. dsbnatut@gmail.com (Kazuki Nishiura) returns supported formats encodes the content The class holds the available options for the Code128 1D Writer if true, don't switch to codeset C for numbers Forces which encoding will be used. Currently only used for Code-128 code sets (Type ). Valid values are "A", "B", "C". Specifies whether to use compact mode for Code-128 code (type {@link Boolean}, or "true" or "false" This can yield slightly smaller bar codes. This option and {@link #FORCE_CODE_SET} are mutually exclusive options. avaiable codesets none specified Codeset A Codeset B Codeset C

Decodes Code 128 barcodes.

Sean Owen

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode or null, if an error occurs or barcode cannot be found
This object renders a CODE128 code as a . erik.barbara@gmail.com (Erik Barbara) returns supported formats Encode the contents following specified format. starts encoding Encodes minimally using Divide-And-Conquer with Memoization Encode the string starting at position position starting with the character set charset

Decodes Code 39 barcodes. Supports "Full ASCII Code 39" if USE_CODE_39_EXTENDED_MODE is set.

Sean Owen @see Code93Reader
Returns a string with all possible characters These represent the encodings of characters, as patterns of wide and narrow bars. The 9 least-significant bits of each int correspond to the pattern of wide and narrow, with 1s representing "wide" and 0s representing narrow. Creates a reader that assumes all encoded data is data, and does not treat the final character as a check digit. It will not decoded "extended Code 39" sequences. Creates a reader that can be configured to check the last character as a check digit. It will not decoded "extended Code 39" sequences. if true, treat the last data character as a check digit, not data, and verify that the checksum passes. Creates a reader that can be configured to check the last character as a check digit, or optionally attempt to decode "extended Code 39" sequences that are used to encode the full ASCII character set. if true, treat the last data character as a check digit, not data, and verify that the checksum passes. if true, will attempt to decode extended Code 39 sequences in the text.

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode
This object renders a CODE39 code as a . erik.barbara@gmail.com (Erik Barbara) returns supported formats Encode the contents to byte array expression of one-dimensional barcode. Start code and end code should be included in result, and side margins should not be included. a {@code boolean[]} of horizontal pixels (false = white, true = black)

Decodes Code 93 barcodes.

Sean Owen
These represent the encodings of characters, as patterns of wide and narrow bars. The 9 least-significant bits of each int correspond to the pattern of wide and narrow. Initializes a new instance of the class.

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode
This object renders a CODE93 code as a BitMatrix returns supported formats barcode contents to encode.It should not be encoded for extended characters. a { @code bool[]} of horizontal pixels(false = white, true = black) output to append to start position pattern to append unused 9

Implements decoding of the EAN-13 format.

dswitkin@google.com (Daniel Switkin) Sean Owen alasdair@google.com (Alasdair Mackintosh)
Initializes a new instance of the class. Subclasses override this to decode the portion of a barcode between the start and end guard patterns. row of black/white values to search start/end offset of start guard pattern to append decoded chars to horizontal offset of first pixel after the "middle" that was decoded or -1 if decoding could not complete successfully Get the format of this decoder. The 1D format. Based on pattern of odd-even ('L' and 'G') patterns used to encoded the explicitly-encoded digits in a barcode, determines the implicitly encoded first digit and adds it to the result string. string to insert decoded first digit into int whose bits indicates the pattern of odd/even L/G patterns used to encode digits -1 if first digit cannot be determined This object renders an EAN13 code as a . aripollak@gmail.com (Ari Pollak) returns supported formats Encode the contents to byte array expression of one-dimensional barcode. Start code and end code should be included in result, and side margins should not be included. a {@code boolean[]} of horizontal pixels (false = white, true = black)

Implements decoding of the EAN-8 format.

Sean Owen
Initializes a new instance of the class. Decodes the middle. The row. The start range. The result. Get the format of this decoder. The 1D format. This object renders an EAN8 code as a . aripollak@gmail.com (Ari Pollak) returns supported formats a byte array of horizontal pixels (false = white, true = black) Records EAN prefix to GS1 Member Organization, where the member organization correlates strongly with a country. This is an imperfect means of identifying a country of origin by EAN-13 barcode value. See http://en.wikipedia.org/wiki/List_of_GS1_country_codes. Sean Owen

Implements decoding of the ITF format, or Interleaved Two of Five.

This Reader will scan ITF barcodes of certain lengths only. At the moment it reads length 6, 8, 10, 12, 14, 16, 18, 20, 24, 44 and 48 as these have appeared "in the wild". Not all lengths are scanned, especially shorter ones, to avoid false positives. This in turn is due to a lack of required checksum function.

The checksum is optional and is not applied by this Reader. The consumer of the decoded value will have to apply a checksum if required.

http://en.wikipedia.org/wiki/Interleaved_2_of_5 is a great reference for Interleaved 2 of 5 information.

kevin.osullivan@sita.aero, SITA Lab.
Valid ITF lengths. Anything longer than the largest value is also allowed. Start/end guard pattern. Note: The end pattern is reversed because the row is reversed before searching for the END_PATTERN Patterns of Wide / Narrow lines to indicate each digit Attempts to decode a one-dimensional barcode format given a single row of an image. row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode row of black/white values to search offset of start pattern The payload end. to append decoded chars to false, if decoding could not complete successfully Identify where the start of the middle / payload section starts. row of black/white values to search Array, containing index of start of 'start block' and end of 'start block' The start & end patterns must be pre/post fixed by a quiet zone. This zone must be at least 10 times the width of a narrow line. Scan back until we either get to the start of the barcode or match the necessary number of quiet zone pixels. Note: Its assumed the row is reversed when using this method to find quiet zone after the end pattern. ref: http://www.barcode-1.net/i25code.html bit array representing the scanned barcode. index into row of the start or end pattern. false, if the quiet zone cannot be found Skip all whitespace until we get to the first black line. row of black/white values to search index of the first black line or -1 if no black lines are found in the row. Identify where the end of the middle / payload section ends. row of black/white values to search Array, containing index of start of 'end block' and end of 'end block' or null, if nothing found row of black/white values to search position to start search pattern of counts of number of black and white pixels that are being searched for as a pattern start/end horizontal offset of guard pattern, as an array of two ints Attempts to decode a sequence of ITF black/white lines into single digit. the counts of runs of observed black/white/black/... values The decoded digit false, if digit cannot be decoded This object renders a ITF code as a . erik.barbara@gmail.com (Erik Barbara) returns supported formats Encode the contents to bool array expression of one-dimensional barcode. Start code and end code should be included in result, and side margins should not be included. a {@code bool[]} of horizontal pixels (false = white, true = black) Decodes MSI barcodes. These represent the encodings of characters, as patterns of wide and narrow bars. The 9 least-significant bits of each int correspond to the pattern of wide and narrow, with 1s representing "wide" and 0s representing narrow. Creates a reader that assumes all encoded data is data, and does not treat the final character as a check digit. Creates a reader that can be configured to check the last character as a check digit, if true, treat the last data character as a check digit, not data, and verify that the checksum passes.

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode
This object renders a MSI code as a . returns supported formats Encode the contents to byte array expression of one-dimensional barcode. Start code and end code should be included in result, and side margins should not be included. a {@code boolean[]} of horizontal pixels (false = white, true = black) dswitkin@google.com (Daniel Switkin) Sean Owen Initializes a new instance of the class. The hints.

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode or null, if an error occurs or barcode cannot be found
Resets any internal state the implementation has after a decode, to prepare it for reuse.

A reader that can read all available UPC/EAN formats. If a caller wants to try to read all such formats, it is most efficient to use this implementation rather than invoke individual readers.

Sean Owen
Initializes a new instance of the class. The hints.

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode or null if an error occurs or barcode cannot be found
Resets any internal state the implementation has after a decode, to prepare it for reuse.

Encapsulates functionality and implementation that is common to one-dimensional barcodes.

dsbnatut@gmail.com (Kazuki Nishiura)
returns supported formats Encode the contents to boolean array expression of one-dimensional barcode. Start code and end code should be included in result, and side margins should not be included. barcode contents to encode a bool[] of horizontal pixels (false = white, true = black) Can be overwritten if the encode requires to read the hints map. Otherwise it defaults to {@code encode}. barcode contents to encode encoding hints a bool[] of horizontal pixels (false = white, true = black) Encode a barcode using the default settings. The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) Encode the contents following specified format. {@code width} and {@code height} are required size. This method may return bigger size {@code BitMatrix} when specified size is too small. The user can set both {@code width} and {@code height} to zero to get minimum size barcode. If negative value is set to {@code width} or {@code height}, {@code IllegalArgumentException} is thrown. a byte array of horizontal pixels (0 = white, 1 = black) Throw ArgumentException if input contains characters other than digits 0-9. string to check for numeric characters if input contains characters other than digits 0-9. Appends the given pattern to the target array starting at pos. encode black/white pattern into this array position to start encoding at in target lengths of black/white runs to encode starting color - false for white, true for black the number of elements added to target. Gets the default margin. Calculates the checksum digit modulo10. The contents. Encapsulates functionality and implementation that is common to all families of one-dimensional barcodes. dswitkin@google.com (Daniel Switkin) Sean Owen Locates and decodes a barcode in some format within an image. image of barcode to decode String which the barcode encodes Locates and decodes a barcode in some format within an image. This method also accepts hints, each possibly associated to some data, which may help the implementation decode. Note that we don't try rotation without the try harder flag, even if rotation was supported. image of barcode to decode passed as a from to arbitrary data. The meaning of the data depends upon the hint type. The implementation may or may not do anything with these hints. String which the barcode encodes Resets any internal state the implementation has after a decode, to prepare it for reuse. We're going to examine rows from the middle outward, searching alternately above and below the middle, and farther out each time. rowStep is the number of rows between each successive attempt above and below the middle. So we'd scan row middle, then middle - rowStep, then middle + rowStep, then middle - (2 * rowStep), etc. rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily decided that moving up and down by about 1/16 of the image is pretty good; we try more of the image if "trying harder". The image to decode Any hints that were requested The contents of the decoded barcode Records the size of successive runs of white and black pixels in a row, starting at a given point. The values are recorded in the given array, and the number of runs recorded is equal to the size of the array. If the row starts on a white pixel at the given start point, then the first count recorded is the run of white pixels starting from that point; likewise it is the count of a run of black pixels if the row begin on a black pixels at that point. row to count from offset into row to start at array into which to record counts Records the size of successive runs of white and black pixels in a row, starting at a given point. The values are recorded in the given array, and the number of runs recorded is equal to the size of the array. If the row starts on a white pixel at the given start point, then the first count recorded is the run of white pixels starting from that point; likewise it is the count of a run of black pixels if the row begin on a black pixels at that point. row to count from offset into row to start at array into which to record counts Records the pattern in reverse. The row. The start. The counters. Determines how closely a set of observed counts of runs of black/white values matches a given target pattern. This is reported as the ratio of the total variance from the expected pattern proportions across all pattern elements, to the length of the pattern. observed counters expected pattern The most any counter can differ before we give up ratio of total variance between counters and pattern compared to total pattern size, where the ratio has been multiplied by 256. So, 0 means no variance (perfect match); 256 means the total variance between counters and patterns equals the pattern length, higher values mean even more variance Attempts to decode a one-dimensional barcode format given a single row of an image. row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode

Decodes PharmaCode

* @author Ruslan Karachun

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode or null, if an error occurs or barcode cannot be found
This object renders a Plessey code as a . returns the list of supported formats Encode the contents to byte array expression of one-dimensional barcode. Start code and end code should be included in result, and side margins should not be included. a {@code boolean[]} of horizontal pixels (false = white, true = black) Superclass of implementations that read barcodes in the RSS family of formats. Initializes a new instance of the class. Gets the decode finder counters. Gets the data character counters. Gets the odd rounding errors. Gets the even rounding errors. Gets the odd counts. Gets the even counts. Parses the finder value. The counters. The finder patterns. The value. Counts the specified array. The array. Increments the specified array. The array. The errors. Decrements the specified array. The array. The errors. Determines whether [is finder pattern] [the specified counters]. The counters. true if [is finder pattern] [the specified counters]; otherwise, false. Encapsulates a since character value in an RSS barcode, including its checksum information. Gets the value. Gets the checksum portion. Initializes a new instance of the class. The value. The checksum portion. Returns a that represents this instance. A that represents this instance. Determines whether the specified is equal to this instance. The to compare with this instance. true if the specified is equal to this instance; otherwise, false. Returns a hash code for this instance. A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Gets the information. Parses the information. Creates the decoder. The information. Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) One row of an RSS Expanded Stacked symbol, consisting of 1+ expanded pairs. Two rows are equal if they contain the same pairs in the same order. Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es)

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode or null, if an error occurs or barcode cannot be found
Resets this instance. Encapsulates an RSS barcode finder pattern, including its start/end position and row. Gets the value. Gets the start end. Gets the result points. Initializes a new instance of the class. The value. The start end. The start. The end. The row number. Determines whether the specified is equal to this instance. The to compare with this instance. true if the specified is equal to this instance; otherwise, false. Returns a hash code for this instance. A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. Decodes RSS-14, including truncated and stacked variants. See ISO/IEC 24724:2006. Initializes a new instance of the class.

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode or null, if an error occurs or barcode cannot be found
Resets this instance. Adapted from listings in ISO/IEC 24724 Appendix B and Appendix G. Gets the RS svalue. The widths. Width of the max. if set to true [no narrow].

Implements decoding of the UPC-A format.

dswitkin@google.com (Daniel Switkin) Sean Owen

Like decodeRow(int, BitArray, java.util.Map), but allows caller to inform method about where the UPC/EAN start pattern is found. This allows this to be computed once and reused across many implementations.

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode or null, if an error occurs or barcode cannot be found
Decodes the specified image. The image. The hints. Get the format of this decoder. The 1D format. Subclasses override this to decode the portion of a barcode between the start and end guard patterns. row of black/white values to search start/end offset of start guard pattern to append decoded chars to horizontal offset of first pixel after the "middle" that was decoded or -1 if decoding could not complete successfully This object renders a UPC-A code as a . qwandor@google.com (Andrew Walbran) Gets the default margin. Encode a barcode using the default settings. The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels Additional parameters to supply to the encoder The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) @see UPCEANExtension5Support Parses the extension string. raw content of extension formatted interpretation of raw content as a {@link Map} mapping @see UPCEANExtension2Support Parses the extension string. raw content of extension formatted interpretation of raw content as a {@link Map} mapping one {@link ResultMetadataType} to appropriate value, or {@code null} if not known

Encapsulates functionality and implementation that is common to UPC and EAN families of one-dimensional barcodes.

dswitkin@google.com (Daniel Switkin) Sean Owen alasdair@google.com (Alasdair Mackintosh)
Start/end guard pattern. Pattern marking the middle of a UPC/EAN pattern, separating the two halves. end guard pattern. "Odd", or "L" patterns used to encode UPC/EAN digits. As above but also including the "even", or "G" patterns used to encode UPC/EAN digits. Initializes a new instance of the class.

Attempts to decode a one-dimensional barcode format given a single row of an image.

row number from top of the row the black/white pixel data of the row decode hints containing encoded string and start/end of barcode or null, if an error occurs or barcode cannot be found

Like , but allows caller to inform method about where the UPC/EAN start pattern is found. This allows this to be computed once and reused across many implementations.

row index into the image encoding of the row of the barcode image start/end column where the opening start pattern was found optional hints that influence decoding encapsulating the result of decoding a barcode in the row
string of digits to check see Computes the UPC/EAN checksum on a string of digits, and reports whether the checksum is correct or not. string of digits to check true iff string of digits passes the UPC/EAN checksum algorithm Decodes the end. The row. The end start. row of black/white values to search position to start search if true, indicates that the pattern specifies white/black/white/... pixel counts, otherwise, it is interpreted as black/white/black/... pattern of counts of number of black and white pixels that are being searched for as a pattern array of counters, as long as pattern, to re-use start/end horizontal offset of guard pattern, as an array of two ints Attempts to decode a single UPC/EAN-encoded digit. row of black/white values to decode the counts of runs of observed black/white/black/... values horizontal offset to start decoding from the set of patterns to use to decode -- sometimes different encodings for the digits 0-9 are used, and this indicates the encodings for 0 to 9 that should be used horizontal offset of first pixel beyond the decoded digit Get the format of this decoder. The 1D format. Subclasses override this to decode the portion of a barcode between the start and end guard patterns. row of black/white values to search start/end offset of start guard pattern to append decoded chars to horizontal offset of first pixel after the "middle" that was decoded or -1 if decoding could not complete successfully

Encapsulates functionality and implementation that is common to UPC and EAN families of one-dimensional barcodes.

aripollak@gmail.com (Ari Pollak) dsbnatut@gmail.com (Kazuki Nishiura)

Implements decoding of the UPC-E format.

Thisis a great reference for UPC-E information.

Sean Owen
The pattern that marks the middle, and end, of a UPC-E pattern. There is no "second half" to a UPC-E barcode. See L_AND_G_PATTERNS these values similarly represent patterns of even-odd parity encodings of digits that imply both the number system (0 or 1) used, and the check digit. Initializes a new instance of the class. Decodes the middle. The row. The start range. The result. Decodes the end. The row. The end start. see checkStandardUPCEANChecksum(String) Determines the num sys and check digit. The result string. The lg pattern found. Get the format of this decoder. The 1D format. Expands a UPC-E value back into its full, equivalent UPC-A code value. UPC-E code as string of digits equivalent UPC-A code as string of digits This object renders an UPC-E code as a {@link BitMatrix}. @author 0979097955s@gmail.com (RX) returns supported formats content encoding method Metadata about a PDF417 Barcode Guenther Grau column count error correction level row count upper row count lower row count initializing constructor A Barcode Value for the PDF417 barcode. The scanner will iterate through the bitmatrix, and given the different methods or iterations will increment a given barcode value's confidence. When done, this will return the values of highest confidence. Guenther Grau Incremenets the Confidence for a given value. (Adds an occurance of a value) Value. Determines the maximum occurrence of a set value and returns all values which were set with this occurrence. an array of int, containing the values with the highest occurrence, or null, if no value was set. Returns the confience value for a given barcode value Barcode value. A Bounding Box helper class Guenther Grau top left corner of the box top right corner of the box bottom left corner of the box bottom right corner of the box min x max x min y max y Initializes a new instance of the class. returns null if the corner points don't match up correctly The image. The top left. The bottom left. The top right. The bottom right. Creates the specified box. The box. Initializes a new instance of the class. Will throw an exception if the corner points don't match up correctly Image. Top left. Top right. Bottom left. Bottom right. Merge two Bounding Boxes, getting the left corners of left, and the right corners of right (Images should be the same) Left. Right. Adds the missing rows. The missing rows. Missing start rows. Missing end rows. If set to true is left. A Codeword in the PDF417 barcode Guenther Grau Default value for the RowNumber (-1 being an invalid real number) start of x coordinates end of x coordinates bucket value row number Initializes a new instance of the class. Start x. End x. Bucket. Value. Gets the width. The width. Gets a value indicating whether this instance has valid row number. true if this instance has valid row number; otherwise, false. Determines whether this instance is valid row number the specified rowNumber. true if this instance is valid row number the specified rowNumber; otherwise, false. Row number. Sets the row number as the row's indicator column. Returns a that represents the current . A that represents the current .

This class contains the methods for decoding the PDF417 codewords.

SITA Lab (kevin.osullivan@sita.aero)
Table containing values for the exponent of 900. This is used in the numeric compaction decode algorithm. Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as well as selected control characters. The array of codewords (data + error) The current index into the codeword array. The decoded data is appended to the result. The next index into the codeword array. The Text Compaction mode includes all the printable ASCII characters (i.e. values from 32 to 126) and three ASCII control characters: HT or tab (ASCII value 9), LF or line feed (ASCII value 10), and CR or carriage return (ASCII value 13). The Text Compaction mode also includes various latch and shift characters which are used exclusively within the mode. The Text Compaction mode encodes up to 2 characters per codeword. The compaction rules for converting data into PDF417 codewords are defined in 5.4.2.2. The sub-mode switches are defined in 5.4.2.3. The text compaction data. The byte compaction data if there was a mode shift. The size of the text compaction and byte compaction data. The decoded data is appended to the result. The mode in which decoding starts The mode in which decoding ended Byte Compaction mode (see 5.4.3) permits all 256 possible 8-bit byte values to be encoded. This includes all ASCII characters value 0 to 127 inclusive and provides for international character set support. The byte compaction mode i.e. 901 or 924 The array of codewords (data + error) The current index into the codeword array. The decoded data is appended to the result. The next index into the codeword array. Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings. The array of codewords (data + error) The current index into the codeword array. The decoded data is appended to the result. The next index into the codeword array. Convert a list of Numeric Compacted codewords from Base 900 to Base 10. EXAMPLE Encode the fifteen digit numeric string 000213298174000 Prefix the numeric string with a 1 and set the initial value of t = 1 000 213 298 174 000 Calculate codeword 0 d0 = 1 000 213 298 174 000 mod 900 = 200 t = 1 000 213 298 174 000 div 900 = 1 111 348 109 082 Calculate codeword 1 d1 = 1 111 348 109 082 mod 900 = 282 t = 1 111 348 109 082 div 900 = 1 234 831 232 Calculate codeword 2 d2 = 1 234 831 232 mod 900 = 632 t = 1 234 831 232 div 900 = 1 372 034 Calculate codeword 3 d3 = 1 372 034 mod 900 = 434 t = 1 372 034 div 900 = 1 524 Calculate codeword 4 d4 = 1 524 mod 900 = 624 t = 1 524 div 900 = 1 Calculate codeword 5 d5 = 1 mod 900 = 1 t = 1 div 900 = 0 Codeword sequence is: 1, 624, 434, 632, 282, 200 Decode the above codewords involves 1 x 900 power of 5 + 624 x 900 power of 4 + 434 x 900 power of 3 + 632 x 900 power of 2 + 282 x 900 power of 1 + 200 x 900 power of 0 = 1000213298174000 Remove leading 1 => Result is 000213298174000 The array of codewords The number of codewords The decoded string representing the Numeric data. Guenther Grau metadata which are found result columns bounding box of the detected result column count row count error correction level initializing constructor Returns the DetectionResult Columns. This does a fair bit of calculation, so call it sparingly. The detection result columns. Adjusts the indicator column row numbers. Detection result column. return number of codewords which don't have a valid row number. Note that the count is not accurate as codewords . will be counted several times. It just serves as an indicator to see when we can stop adjusting row numbers The row numbers. Adjusts the row numbers by row. The row numbers by row. Adjusts the row numbers from both Row Indicators zero Adjusts the row numbers from Right Row Indicator. The unadjusted row count. Adjusts the row numbers from Left Row Indicator. Unadjusted row Count. Adjusts the row number if valid. The invalid rows Row indicator row number. Invalid row counts. Codeword. Adjusts the row numbers. Barcode column. Codewords row. Codewords. Adjusts the row number. true, if row number was adjusted, false otherwise. Codeword. Other codeword. Returns a that represents the current . A that represents the current . Represents a Column in the Detection Result Guenther Grau The maximum distance to search in the codeword array in both the positive and negative directions The Bounding Box around the column (in the BitMatrix) The box. The Codewords the Box encodes for, offset by the Box minY. Remember to Access this ONLY through GetCodeword(imageRow) if you're accessing it in that manner. The codewords. Initializes a new instance of the class. The Bounding Box around the column (in the BitMatrix) Converts the Image's Row to the index in the Codewords array The Codeword Index. Image row. Converts the Codeword array index into a Row in the Image (BitMatrix) The Image Row. Codeword index. Gets the codeword for a given row The codeword. Image row. Gets the codeword closest to the specified row in the image Image row. Sets the codeword for an image row Image row. Codeword. Returns a that represents the current . A that represents the current . Represents a Column in the Detection Result Guenther Grau Gets or sets a value indicating whether this instance is the left indicator true if this instance is left; otherwise, false. Initializes a new instance of the class. Box. If set to true is left. Sets the Row Numbers as Inidicator Columns TODO implement properly TODO maybe we should add missing codewords to store the correct row number to make finding row numbers for other columns easier use row height count to make detection of invalid row numbers more reliable The indicator column row numbers. Metadata. Gets the row heights. The row heights. Adjusts the in omplete indicator column row numbers. Metadata. Gets the barcode metadata. The barcode metadata. Prune the codewords which do not match the metadata TODO Maybe we should keep the incorrect codewords for the start and end positions? Codewords. Metadata. Returns a that represents the current . A that represents the current .

PDF417 error correction implementation.

This example is quite useful in understanding the algorithm.

Sean Owen
Initializes a new instance of the class. Decodes the specified received. received codewords number of those codewords used for EC location of erasures The error locations count. Runs the euclidean algorithm (Greatest Common Divisor) until r's degree is less than R/2 The euclidean algorithm. Finds the error locations as a direct application of Chien's search The error locations. Error locator. Finds the error magnitudes by directly applying Forney's Formula The error magnitudes. Error evaluator. Error locator. Error locations.

A field based on powers of a generator integer, modulo some modulus.

Sean Owen
Sean Owen Gets the coefficients. The coefficients. degree of this polynomial Gets a value indicating whether this instance is zero. true if this polynomial is the monomial "0" coefficient of x^degree term in this polynomial The degree. coefficient of x^degree term in this polynomial evaluation of this polynomial at a given point A. evaluation of this polynomial at a given point Adds another Modulus Other. Subtract another Modulus Other. Multiply by another Modulus Other. Returns a Negative version of this instance Multiply by a Scalar. Scalar. Multiplies by a Monomial The by monomial. Degree. Coefficient. Returns a that represents the current . A that represents the current . Guenther Grau creatale GmbH (christoph.schulz@creatale.de) The ratios table Initializes the class & Pre-computes the symbol ratio table. Gets the decoded value. The decoded value. Module bit count. Samples the bit counts. The bit counts. Module bit count. Gets the decoded codeword value. The decoded codeword value. Module bit count. Gets the bit value. The bit value. Module bit count. Gets the closest decoded value. The closest decoded value. Module bit count. Guenther Grau Decode the specified image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight, minCodewordWidth and maxCodewordWidth. TODO: don't pass in minCodewordWidth and maxCodewordWidth, pass in barcode columns for start and stop pattern columns. That way width can be deducted from the pattern column. This approach also allows to detect more details about the barcode, e.g. if a bar type (white or black) is wider than it should be. This can happen if the scanner used a bad blackpoint. Image. Image top left. Image bottom left. Image top right. Image bottom right. Minimum codeword width. Max codeword width. Merge the specified leftRowIndicatorColumn and rightRowIndicatorColumn. Left row indicator column. Right row indicator column. Adjusts the bounding box. The bounding box. Row indicator column. Gets the barcode metadata. The barcode metadata. Left row indicator column. Right row indicator column. Gets the row indicator column. The row indicator column. Image. Bounding box. Start point. If set to true left to right. Minimum codeword width. Max codeword width. Adjusts the codeword count. Detection result. Barcode matrix. Creates the decoder result. The decoder result. Detection result. This method deals with the fact, that the decoding process doesn't always yield a single most likely value. The current error correction implementation doesn't deal with erasures very well, so it's better to provide a value for these ambiguous codewords instead of treating it as an erasure. The problem is that we don't know which of the ambiguous values to choose. We try decode using the first value, and if that fails, we use another of the ambiguous values and try to decode again. This usually only happens on very hard to read and decode barcodes, so decoding the normal barcodes is not affected by this. The decoder result from ambiguous values. Ec level. Codewords. contains the indexes of erasures. array with the indexes that have more than one most likely value. two dimensional array that contains the ambiguous values. The first dimension must be the same Length as the ambiguousIndexes array. Creates the barcode matrix. The barcode matrix. Detection result. Tests to see if the Barcode Column is Valid true, if barcode column is valid, false otherwise. Detection result. Barcode column. Gets the start column. The start column. Detection result. Barcode column. Image row. If set to true left to right. Detects the codeword. The codeword. Image. Minimum column. Max column. If set to true left to right. Start column. Image row. Minimum codeword width. Max codeword width. Gets the module bit count. The module bit count. Image. Minimum column. Max column. If set to true left to right. Start column. Image row. Gets the number of EC code words. The number of EC code words. Barcode EC level. Adjusts the codeword start column. The codeword start column. Image. Minimum column. Max column. If set to true left to right. Codeword start column. Image row. Checks the codeword for any skew. true, if codeword is within the skew, false otherwise. Codeword size. Minimum codeword width. Max codeword width. Decodes the codewords. The codewords. Codewords. Ec level. Erasures. Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place. The errors. data and error correction codewords. positions of any known erasures. number of error correction codewords that are available in codewords. Verifies that all is well with the the codeword array. Codewords. Number EC codewords. Gets the bit count for codeword. The bit count for codeword. Codeword. Gets the codeword bucket number. The codeword bucket number. Codeword. Gets the codeword bucket number. The codeword bucket number. Module bit count. Returns a that represents the jagged array. A that represents the jagged array. Barcode matrix as a jagged array.

Encapsulates logic that can detect a PDF417 Code in an image, even if the PDF417 Code is rotated or skewed, or partially obscured.

SITA Lab (kevin.osullivan@sita.aero) dswitkin@google.com (Daniel Switkin) Guenther Grau
B S B S B S B S Bar/Space pattern 11111111 0 1 0 1 0 1 000. 1111111 0 1 000 1 0 1 00 1 if we set the value too low, then we don't detect the correct height of the bar if the start patterns are damaged. if we set the value too high, then we might detect the start pattern from a neighbor barcode. A PDF471 barcode should have at least 3 rows, with each row being >= 3 times the module width. Therefore it should be at least 9 pixels tall. To be conservative, we use about half the size to ensure we don't miss it.

Detects a PDF417 Code in an image. Checks 0, 90, 180, and 270 degree rotations.

barcode image to decode optional hints to detector if true, then the image is searched for multiple codes. If false, then at most one code will be found and returned encapsulating results of detecting a PDF417 code
Applies a rotation to the supplied BitMatrix. bit matrix to apply rotation to the degrees of rotation to apply BitMatrix with applied rotation Detects PDF417 codes in an image. Only checks 0 degree rotation (so rotate the matrix and check again outside of this method) multiple if true, then the image is searched for multiple codes. If false, then at most one code will be found and returned. bit matrix to detect barcodes in. List of ResultPoint arrays containing the coordinates of found barcodes Locate the vertices and the codewords area of a black blob using the Start and Stop patterns as locators. Matrix. Start row. Start column. an array containing the vertices: vertices[0] x, y top left barcode vertices[1] x, y bottom left barcode vertices[2] x, y top right barcode vertices[3] x, y bottom right barcode vertices[4] x, y top left codeword area vertices[5] x, y bottom left codeword area vertices[6] x, y top right codeword area vertices[7] x, y bottom right codeword area Copies the temp data to the final result Result. Temp result. Destination indexes. Finds the rows with the given pattern. The rows with pattern. Matrix. Height. Width. Start row. Start column. Pattern. Finds the guard pattern. Uses System.Linq.Enumerable.Repeat to fill in counters. This might be a performance issue? start/end horizontal offset of guard pattern, as an array of two ints. matrix row of black/white values to search column x position to start search. row y position to start search. width the number of pixels to search on this row. pattern of counts of number of black and white pixels that are being searched for as a pattern. counters array of counters, as long as pattern, to re-use . Determines how closely a set of observed counts of runs of black/white. values matches a given target pattern. This is reported as the ratio of the total variance from the expected pattern proportions across all pattern elements, to the length of the pattern. ratio of total variance between counters and pattern compared to total pattern size, where the ratio has been multiplied by 256. So, 0 means no variance (perfect match); 256 means the total variance between counters and patterns equals the pattern length, higher values mean even more variance observed counters. expected pattern. PDF 417 Detector Result class. Skipped private backing stores. Guenther Grau bit matrix of the detected result points of the detected result in the image Initializes a new instance of the class. Bits. Points. Rotation. Initializes a new instance of the class. Bits. Points. Holds all of the information for a barcode in a format where it can be easily accessible Jacob Haynes the height of the matrix (Rows) the width of the matrix (Cols) defines if a compact PDF417 should be encoded Jacob Haynes Creates a Barcode row of the width The width. Sets a specific location in the bar The location in the bar Black if true, white if false; Sets a specific location in the bar The location in the bar Black if true, white if false; A boolean which is true if the bar black false if it is white How many spots wide the bar is. This function scales the row How much you want the image to be scaled, must be greater than or equal to 1. the scaled row Represents possible PDF417 barcode compaction types. Data object to specify the minimum and maximum number of rows and columns for a PDF417 barcode. @author qwandor@google.com (Andrew Walbran) Initializes a new instance of the class. The min cols. The max cols. The min rows. The max rows. Gets the min cols. Gets the max cols. Gets the min rows. Gets the max rows. Top-level class for the logic part of the PDF417 implementation. The start pattern (17 bits) The stop pattern (18 bits) The macro last segment The macro segment identifier The codeword table from the Annex A of ISO/IEC 15438:2001(E). Calculates the necessary number of rows as described in annex Q of ISO/IEC 15438:2001(E). the number of source codewords prior to the additional of the Symbol Length Descriptor and any pad codewords the number of error correction codewords the number of columns in the symbol in the data region (excluding start, stop and row indicator codewords) the number of rows in the symbol (r) Calculates the number of pad codewords as described in 4.9.2 of ISO/IEC 15438:2001(E). the number of source codewords prior to the additional of the Symbol Length Descriptor and any pad codewords the number of error correction codewords the number of columns in the symbol in the data region (excluding start, stop and row indicator codewords) the number of rows in the symbol the number of pad codewords Generates the barcode logic. the message to encode PDF417 error correction level to use Generates the barcode logic. the message to encode PDF417 error correction level to use automatically insert ECIs if needed Gets the macro block. System.String. The macro segment index must be greater than or equal to 0. or The macro segment index must be less than the segment count. or The macro segment count must be greater than 0. Appends optional macro fields. The field. The value. The source code word length. The macro codewords. Determine optimal nr of columns and rows for the specified number of codewords. number of code words number of error correction code words The longest dimension of the barcode, used for columns The short dimension of the barcode, used for rows The height of a row, will alter this parameter if aspectRatio>4 (aspectRatio==AUTO) dimension object containing cols as width and rows as height Sets the desired aspect ratio for the output image. Sets max/min row/col values maximum allowed columns minimum allowed columns maximum allowed rows minimum allowed rows Sets compaction to values stored in enum compaction mode to use Sets compact to be true or false if true, enables compaction Sets output encoding. sets character encoding to use Sets the disable eci. if set to true don't add an ECI segment for different encodings than default. Sets the meta data. The metadata. defines the aspect ratio of the image ratio 1 ratio 2 ratio 3 ratio 4 automatic selection PDF417 error correction code following the algorithm described in ISO/IEC 15438:2001(E) in chapter 4.10. Tables of coefficients for calculating error correction words (see annex F, ISO/IEC 15438:2001(E)) Determines the number of error correction codewords for a specified error correction level. the error correction level (0-8) the number of codewords generated for error correction Determines the error correction level for AUTO The error correction level (0-9) The number of codewords for AUTO errorCorrectionLevel the number of codewords generated for error correction Returns the recommended minimum error correction level as described in annex E of ISO/IEC 15438:2001(E). the number of data codewords the recommended minimum error correction level Generates the error correction codewords according to 4.10 in ISO/IEC 15438:2001(E). the data codewords the error correction level (0-8) the String representing the error correction codewords defines the level of the error correction / count of error correction codewords level 0 level 1 level 2 level 3 level 4 level 5 level 6 level 7 level 8 automatic selection PDF417 high-level encoder following the algorithm described in ISO/IEC 15438:2001(E) in annex P. code for Text compaction code for Byte compaction code for Numeric compaction Text compaction submode Alpha Text compaction submode Lower Text compaction submode Mixed Text compaction submode Punctuation mode latch to Text Compaction mode mode latch to Byte Compaction mode (number of characters NOT a multiple of 6) mode latch to Numeric Compaction mode mode shift to Byte Compaction mode mode latch to Byte Compaction mode (number of characters a multiple of 6) identifier for a user defined Extended Channel Interpretation (ECI) identifier for a general purpose ECO format identifier for an ECI of a character set of code page Raw code table for text compaction Mixed sub-mode Raw code table for text compaction: Punctuation sub-mode Performs high-level encoding of a PDF417 message using the algorithm described in annex P of ISO/IEC 15438:2001(E). If byte compaction has been selected, then only byte compaction is used. the message compaction mode to use character encoding used to encode in default or byte compaction or null for default / not applicable if true, don't add an ECI segment for different encodings than default encode input minimally using multiple ECIs if needed If autoECI encoding is specified and additionally {@code encoding} is specified, then the encoder will use the specified {@link Charset} for any character that can be encoded by it, regardless if a different encoding would lead to a more compact encoding. When no {@code encoding} is specified then charsets will be chosen so that the byte representation is minimal. the encoded message (the char values range from 0 to 928) Encode parts of the message using Text Compaction as described in ISO/IEC 15438:2001(E), chapter 4.4.2. the input the start position within the message the number of characters to encode receives the encoded codewords should normally be SUBMODE_ALPHA the text submode in which this method ends Encode all of the message using Byte Compaction as described in ISO/IEC 15438:2001(E) the input the start position within the message the number of bytes to encode the mode from which this method starts receives the encoded codewords Encode parts of the message using Byte Compaction as described in ISO/IEC 15438:2001(E), chapter 4.4.3. The Unicode characters will be converted to binary using the cp437 codepage. the message converted to a byte array the start position within the message the number of bytes to encode the mode from which this method starts receives the encoded codewords Determines the number of consecutive characters that are encodable using numeric compaction. the input the start position within the message the requested character count Determines the number of consecutive characters that are encodable using text compaction. the input the start position within the message the requested character count Determines the number of consecutive characters that are encodable using binary compaction. the input the start position within the message the requested character count Macro PDF417 optional fields. The values are set to their field designator. The file name. Field designator: 0 The segment count field can contain values from 1 to 99,999. Field designator: 1 The time stamp of the source file expressed in Unix time. Field designator: 2 The sender. Field designator: 3 The addressee. Field designator: 4 The file size in bytes. Field designator: 5 The 16-bit CRC checksum using the CCITT-16 polynomial. Field designator: 6 The class holds the available options for the Specifies whether to use compact mode for PDF417 (type ). Specifies what compaction mode to use for PDF417 (type ). Specifies the minimum and maximum number of rows and columns for PDF417 (type ). Specifies what degree of error correction to use Specifies the aspect ratio of the smallest codeword. (Width of narrowest bar / Row Height) Specifies the desired output image aspect ratio (Width / Height). The actual aspect ratio is calculated based on the necessary number of codewords. Specifies what character encoding to use where applicable (type {@link String}) Explicitly disables ECI segment when generating PDF417 Code That is against the specification but some readers have problems if the charset is switched from CP437 (default) to UTF-8 with the necessary ECI segment. If you set the property to true you can use different encodings and the ECI segment is omitted. SITA Lab (kevin.osullivan@sita.aero) Guenther Grau Maximum Codewords (Data + Error). Gets the bit count sum. The bit count sum. Module bit count. Converts an ICollection<int> to an int[] Carry-over from Java. Will likely remove and replace with the Generic .ToArray() method. The int array. List. Translate the symbol into a codeword the codeword corresponding to the symbol. encoded symbol to translate to a codeword The sorted table of all possible symbols. Extracted from the PDF417 specification. The index of a symbol in this table corresponds to the index into the codeword table. This table contains to codewords for all symbols. PDF417 Macro meta data. The Segment ID represents the segment of the whole file distributed over different symbols. Is the same for each related PDF417 symbol true if it is the last segment count of segments, -1 if not set sender address Filename of the encoded file filesize in bytes of the encoded file returns filesize in bytes, -1 if not set 16-bit CRC checksum using CCITT-16 returns crc checksum, -1 if not set unix epock timestamp, elapsed seconds since 1970-01-01 returns elapsed seconds, -1 if not set This implementation can detect and decode PDF417 codes in an image. SITA Lab (kevin.osullivan@sita.aero) Guenther Grau Locates and decodes a PDF417 code in an image. a String representing the content encoded by the PDF417 code if a PDF417 cannot be decoded Locates and decodes a barcode in some format within an image. This method also accepts hints, each possibly associated to some data, which may help the implementation decode. **Note** this will return the FIRST barcode discovered if there are many. image of barcode to decode passed as a from to arbitrary data. The meaning of the data depends upon the hint type. The implementation may or may not do anything with these hints. String which the barcode encodes Locates and decodes Multiple PDF417 codes in an image. an array of Strings representing the content encoded by the PDF417 codes Locates and decodes multiple barcodes in some format within an image. This method also accepts hints, each possibly associated to some data, which may help the implementation decode. image of barcode to decode passed as a from to arbitrary data. The meaning of the data depends upon the hint type. The implementation may or may not do anything with these hints. String which the barcodes encode Decode the specified image, with the hints and optionally multiple barcodes. Based on Owen's Comments in , this method has been modified to continue silently if a barcode was not decoded where it was detected instead of throwing a new exception object. Image. Hints. If set to true multiple. Gets the maximum width of the barcode The max width. P1. P2. Gets the minimum width of the barcode The minimum width. P1. P2. Gets the maximum width of the codeword. The max codeword width. P. Gets the minimum width of the codeword. The minimum codeword width. P. Resets any internal state the implementation has after a decode, to prepare it for reuse. PDF 417 result meta data. Guenther Grau default constructor The Segment ID represents the segment of the whole file distributed over different symbols. Is the same for each related PDF417 symbol old optional data format as int array, always null true if it is the last segment count of segments, -1 if not set sender address Filename of the encoded file filesize in bytes of the encoded file returns filesize in bytes, -1 if not set 16-bit CRC checksum using CCITT-16 returns crc checksum, -1 if not set unix epock timestamp, elapsed seconds since 1970-01-01 returns elapsed seconds, -1 if not set string represenation of that instance Jacob Haynes qwandor@google.com (Andrew Walbran) default white space (margin) around the code default error correction level default aspect ratio The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels Additional parameters to supply to the encoder The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) Encode a barcode using the default settings. The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) Takes encoder, accounts for width/height, and retrieves bit matrix This takes an array holding the values of the PDF 417 a byte array of information with 0 is black, and 1 is white border around the barcode BitMatrix of the input Takes and rotates the it 90 degrees Sean Owen {@link BitMatrix} to parse ReaderException if dimension is not >= 21 and 1 mod 4

Reads format information from one of its two locations within the QR Code.

{@link FormatInformation} encapsulating the QR Code's format info ReaderException if both format information locations cannot be parsed as the valid encoding of format information

Reads version information from one of its two locations within the QR Code.

{@link Version} encapsulating the QR Code's version ReaderException if both version information locations cannot be parsed as the valid encoding of version information

Reads the bits in the {@link BitMatrix} representing the finder pattern in the correct order in order to reconstruct the codewords bytes contained within the QR Code.

bytes encoded within the QR Code ReaderException if the exact number of bytes expected is not read
Revert the mask removal done while reading the code words. The bit matrix should revert to its original state. Prepare the parser for a mirrored operation. This flag has effect only on the {@link #readFormatInformation()} and the {@link #readVersion()}. Before proceeding with {@link #readCodewords()} the {@link #mirror()} method should be called. @param mirror Whether to read version and format information mirrored. Mirror the bit matrix in order to attempt a second reading.

Encapsulates a block of data within a QR Code. QR Codes may split their data into multiple blocks, each of which is a unit of data and error-correction codewords. Each is represented by an instance of this class.

Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source

When QR Codes use multiple data blocks, they are actually interleaved. That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This method will separate the data into original blocks.

bytes as read directly from the QR Code version of the QR Code error-correction level of the QR Code {@link DataBlock}s containing original bytes, "de-interleaved" from representation in the QR Code

Encapsulates data masks for the data bits in a QR code, per ISO 18004:2006 6.8. Implementations of this class can un-mask a raw BitMatrix. For simplicity, they will unmask the entire BitMatrix, including areas used for finder patterns, timing patterns, etc. These areas should be unused after the point they are unmasked anyway.

Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position and j is row position. In fact, as the text says, i is row position and j is column position.

Sean Owen
See ISO 18004:2006 6.8.1

Implementations of this method reverse the data masking process applied to a QR Code and make its bits ready to read.

representation of QR Code bits dimension of QR Code, represented by bits, being unmasked

QR Codes can encode text as bits in one of several modes, and can use multiple modes in one QR Code. This class decodes the bits back into text.

See ISO 18004:2006, 6.4.3 - 6.4.7

Sean Owen
See ISO 18004:2006, 6.4.4 Table 5 See specification GBT 18284-2000 The bits. The result. The count.

The main class which implements QR Code decoding -- as opposed to locating and extracting the QR Code from an image.

Sean Owen
Initializes a new instance of the class.

Convenience method that can decode a QR Code represented as a 2D array of booleans. "true" is taken to mean a black module.

booleans representing white/black QR Code modules decoding hints that should be used to influence decoding text and bytes encoded within the QR Code

Decodes a QR Code represented as a {@link BitMatrix}. A 1 or "true" is taken to mean a black module.

booleans representing white/black QR Code modules decoding hints that should be used to influence decoding text and bytes encoded within the QR Code

Given data and error-correction codewords received, possibly corrupted by errors, attempts to correct the errors in-place using Reed-Solomon error correction.

data and error correction codewords number of codewords that are data bytes

See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels defined by the QR code standard.

Sean Owen
L = ~7% correction M = ~15% correction Q = ~25% correction H = ~30% correction Gets the bits. Gets the name. Ordinals this instance. Returns a that represents this instance. A that represents this instance. Fors the bits. int containing the two bits encoding a QR Code's error correction level representing the encoded error correction level

Encapsulates a QR Code's format information, including the data mask used and error correction level.

Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source
See ISO 18004:2006, Annex C, Table C.1 Offset i holds the number of 1 bits in the binary representation of i Decodes the format information. format info indicator, with mask still applied The masked format info2. information about the format it specifies, or null if doesn't seem to match any known pattern

See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which data can be encoded to bits in the QR code standard.

Sean Owen
Gets the name. enumeration for encoding modes numeric encoding alpha-numeric encoding structured append byte mode encoding ECI segment Kanji mode FNC1 char, first position FNC1 char, second position Hanzi mode Not really a mode... Not supported character counts don't apply See GBT 18284-2000; "Hanzi" is a transliteration of this mode name. Fors the bits. four bits encoding a QR Code data mode encoded by these bits if bits do not correspond to a known mode version in question number of bits used, in this QR Code symbol {@link Version}, to encode the count of characters that will follow encoded in this {@link Mode} Gets the bits. Returns a that represents this instance. A that represents this instance. Meta-data container for QR Code decoding. Instances of this class may be used to convey information back to the decoding caller. Callers are expected to process this. Initializes a new instance of the class. if set to true [mirrored]. The mask applied to the bit matrix true if the QR Code was mirrored. The mask applied to the QR code Apply the result points' order correction due to mirroring. Array of points to apply mirror correction to. See ISO 18004:2006 Annex D Sean Owen See ISO 18004:2006 Annex D. Element i represents the raw version bits that specify version i + 7 Gets the version number. Gets the alignment pattern centers. Gets the total codewords. Gets the dimension for version. Gets the EC blocks for level. The ec level.

Deduces version information purely from QR Code dimensions.

dimension in modules for a QR Code of that dimension or null
Gets the version for number. The version number. See ISO 18004:2006 Annex E

Encapsulates a set of error-correction blocks in one symbol version. Most versions will use blocks of differing sizes within one version, so, this encapsulates the parameters for each set of blocks. It also holds the number of error-correction codewords per block since it will be the same across all blocks within one version.

Gets the EC codewords per block. Gets the num blocks. Gets the total EC codewords. Gets the EC blocks.

Encapsulates the parameters for one error-correction block in one symbol version. This includes the number of data codewords, and the number of times a block with these parameters is used consecutively in the QR code version's format.

Gets the count. Gets the data codewords. Returns a that represents this instance. A that represents this instance. See ISO 18004:2006 6.5.1 Table 9

Encapsulates an alignment pattern, which are the smaller square patterns found in all but the simplest QR Codes.

Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source

Determines if this alignment pattern "about equals" an alignment pattern at the stated position and size -- meaning, it is at nearly the same center with nearly the same size.

Combines this object's current estimate of a finder pattern position and module size with a new estimate. It returns a new {@code FinderPattern} containing an average of the two. The i. The j. New size of the module.

This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder patterns but are smaller and appear at regular intervals throughout the image.

At the moment this only looks for the bottom-right alignment pattern.

This is mostly a simplified copy of {@link FinderPatternFinder}. It is copied, pasted and stripped down here for maximum performance but does unfortunately duplicate some code.

This class is thread-safe but not reentrant. Each thread must allocate its own object.

Sean Owen www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source

Creates a finder that will look in a portion of the whole image.

image to search left column from which to start searching top row from which to start searching width of region to search height of region to search estimated module size so far callback function which is called, when a result point is found

This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since it's pretty performance-critical and so is written to be fast foremost.

if found
Given a count of black/white/black pixels just seen and an end position, figures the location of the center of this black/white/black run. count of black/white/black pixels just read true iff the proportions of the counts is close enough to the 1/1/1 ratios used by alignment patterns to be considered a match

After a horizontal scan finds a potential alignment pattern, this method "cross-checks" by scanning down vertically through the center of the possible alignment pattern to see if the same proportion is detected.

row where an alignment pattern was detected center of the section that appears to cross an alignment pattern maximum reasonable number of modules that should be observed in any reading state, based on the results of the horizontal scan The original state count total. vertical center of alignment pattern, or null if not found

This is called when a horizontal scan finds a possible alignment pattern. It will cross check with a vertical scan, and if successful, will see if this pattern had been found on a previous horizontal scan. If so, we consider it confirmed and conclude we have found the alignment pattern.

reading state module counts from horizontal scan row where alignment pattern may be found end of possible alignment pattern in row {@link AlignmentPattern} if we have found the same pattern twice, or null if not

Encapsulates logic that can detect a QR Code in an image, even if the QR Code is rotated or skewed, or partially obscured.

Sean Owen
Initializes a new instance of the class. The image. Gets the image. Gets the result point callback.

Detects a QR Code in an image.

encapsulating results of detecting a QR Code

Detects a QR Code in an image.

optional hints to detector encapsulating results of detecting a QR Code
Processes the finder pattern info. The info.

Computes the dimension (number of modules on a size) of the QR Code based on the position of the finder patterns and estimated module size.

Computes an average estimated module size based on estimated derived from the positions of the three finder patterns.

detected top-left finder pattern center detected top-right finder pattern center detected bottom-left finder pattern center estimated module size

Estimates module size based on two finder patterns -- it uses {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the width of each, measuring along the axis between their centers.

See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of a finder pattern by looking for a black-white-black run from the center in the direction of another point (another finder pattern center), and in the opposite direction too.

This method traces a line from a point in the image, in the direction towards another point. It begins in a black region, and keeps going until it finds white, then black, then white again. It reports the distance from the start to this point.

This is used when figuring out how wide a finder pattern is, when the finder pattern may be skewed or rotated.

Attempts to locate an alignment pattern in a limited region of the image, which is guessed to contain it. This method uses {@link AlignmentPattern}.

estimated module size so far x coordinate of center of area probably containing alignment pattern y coordinate of above number of pixels in all directions to search from the center if found, or null otherwise

Encapsulates a finder pattern, which are the three square patterns found in the corners of QR Codes. It also encapsulates a count of similar finder patterns, as a convenience to the finder's bookkeeping.

Sean Owen
Gets the size of the estimated module. The size of the estimated module.

Determines if this finder pattern "about equals" a finder pattern at the stated position and size -- meaning, it is at nearly the same center with nearly the same size.

Combines this object's current estimate of a finder pattern position and module size with a new estimate. It returns a new {@code FinderPattern} containing a weighted average based on count. The i. The j. New size of the module.

This class attempts to find finder patterns in a QR Code. Finder patterns are the square markers at three corners of a QR Code.

This class is thread-safe but not reentrant. Each thread must allocate its own object.

Sean Owen
1 pixel/module times 3 modules/center support up to version 20 for mobile clients

Creates a finder that will search the image for three finder patterns.

image to search
Initializes a new instance of the class. The image. The result point callback. Gets the image. Gets the possible centers. Given a count of black/white/black/white/black pixels just seen and an end position, figures the location of the center of this run. count of black/white/black/white/black pixels just read true iff the proportions of the counts is close enough to the 1/1/3/1/1 ratios used by finder patterns to be considered a match count of black/white/black/white/black pixels just read true if the proportions of the counts is close enough to the 1/1/3/1/1 ratios by finder patterns to be considered a match sets everything to 0 shifts left by 2 index sets everything to 0 shifts left by 2 index After a vertical and horizontal scan finds a potential finder pattern, this method "cross-cross-cross-checks" by scanning down diagonally through the center of the possible finder pattern to see if the same proportion is detected. row where a finder pattern was detected center of the section that appears to cross a finder pattern true if proportions are withing expected limits

After a horizontal scan finds a potential finder pattern, this method "cross-checks" by scanning down vertically through the center of the possible finder pattern to see if the same proportion is detected.

row where a finder pattern was detected center of the section that appears to cross a finder pattern maximum reasonable number of modules that should be observed in any reading state, based on the results of the horizontal scan The original state count total. vertical center of finder pattern, or null if not found

Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical, except it reads horizontally instead of vertically. This is used to cross-cross check a vertical cross check and locate the real center of the alignment pattern.

@see #handlePossibleCenter(int[], int, int) reading state module counts from horizontal scan row where finder pattern may be found end of possible finder pattern in row ignored true if a finder pattern candidate was found this time

This is called when a horizontal scan finds a possible alignment pattern. It will cross check with a vertical scan, and if successful, will, ah, cross-cross-check with another horizontal scan. This is needed primarily to locate the real horizontal center of the pattern in cases of extreme skew. And then we cross-cross-cross check with another diagonal scan.

If that succeeds the finder pattern location is added to a list that tracks the number of times each location has been nearly-matched as a finder pattern. Each additional find is more evidence that the location is in fact a finder pattern center
reading state module counts from horizontal scan row where finder pattern may be found end of possible finder pattern in row true if a finder pattern candidate was found this time
number of rows we could safely skip during scanning, based on the first two finder patterns that have been located. In some cases their position will allow us to infer that the third pattern must lie below a certain point farther down in the image. true iff we have found at least 3 finder patterns that have been detected at least {@link #CENTER_QUORUM} times each, and, the estimated module size of the candidates is "pretty similar" Get square of distance between a and b. the 3 best {@link FinderPattern}s from our list of candidates. The "best" are those have similar module size and form a shape closer to a isosceles right triangle. Orders by {@link FinderPatternFinder#getEstimatedModuleSize()}

Encapsulates information about finder patterns in an image, including the location of the three finder patterns, and their estimated module size.

Sean Owen
Initializes a new instance of the class. The pattern centers. Gets the bottom left. Gets the top left. Gets the top right. JAVAPORT: The original code was a 2D array of ints, but since it only ever gets assigned 0, 1 and 2 I'm going to use less memory and go with bytes. dswitkin@google.com (Daniel Switkin) Initializes a new instance of the class. The width. The height. Gets the height. Gets the width. Gets or sets the with the specified x. an internal representation as bytes, in row-major order. array[y][x] represents point (x,y) Sets the specified x. The x. The y. The value. Sets the specified x. The x. The y. if set to true [value]. Clears the specified value. The value. Returns a that represents this instance. A that represents this instance. satorux@google.com (Satoru Takabayashi) - creator dswitkin@google.com (Daniel Switkin) - ported from C++ Encode "bytes" with the error correction level "ecLevel". The encoding mode will be chosen internally by chooseMode(). On success, store the result in "qrCode". We recommend you to use QRCode.EC_LEVEL_L (the lowest level) for "getECLevel" since our primary use is to show QR code on desktop screens. We don't need very strong error correction for this purpose. Note that there is no way to encode bytes in MODE_KANJI. We might want to add EncodeWithMode() with which clients can specify the encoding mode. For now, we don't need the functionality. text to encode error correction level to use representing the encoded QR code Encodes the specified content. The content. The ec level. The hints. Decides the smallest version of QR code that will contain all of the provided data. if the data cannot fit in any version Gets the alphanumeric code. The code. the code point of the table used in alphanumeric mode or -1 if there is no corresponding code in the table. Chooses the mode. The content. Choose the best mode by examining the content. Note that 'encoding' is used as a hint; if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}. The content. The encoding. true if the number of input bits will fit in a code with the specified version and error correction level. Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24). The num data bytes. The bits. Get number of data bytes and number of error correction bytes for block id "blockID". Store the result in "numDataBytesInBlock", and "numECBytesInBlock". See table 12 in 8.5.1 of JISX0510:2004 (p.30) The num total bytes. The num data bytes. The num RS blocks. The block ID. The num data bytes in block. The num EC bytes in block. Interleave "bits" with corresponding error correction bytes. On success, store the result in "result". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details. The bits. The num total bytes. The num data bytes. The num RS blocks. Append mode info. On success, store the result in "bits". The mode. The bits. Append length info. On success, store the result in "bits". The num letters. The version. The mode. The bits. Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits". The content. The mode. The bits. The encoding. Satoru Takabayashi Daniel Switkin Sean Owen Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and give penalty to them. Example: 00000 or 11111. The matrix. Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block. The matrix. Apply mask penalty rule 3 and return the penalty. Find consecutive cells of 00001011101 or 10111010000, and give penalty to them. If we find patterns like 000010111010000, we give penalties twice (i.e. 40 * 2). The matrix. Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance. The matrix. Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask pattern conditions. The mask pattern. The x. The y. Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both vertical and horizontal orders respectively. The matrix. if set to true [is horizontal]. satorux@google.com (Satoru Takabayashi) - creator Set all cells to 2. 2 means that the cell is empty (not set yet). JAVAPORT: We shouldn't need to do this at all. The code should be rewritten to begin encoding with the ByteMatrix initialized all to zero. The matrix. Build 2D matrix of QR Code from "dataBits" with "ecLevel", "version" and "getMaskPattern". On success, store the result in "matrix" and return true. The data bits. The ec level. The version. The mask pattern. The matrix. Embed basic patterns. On success, modify the matrix and return true. The basic patterns are: - Position detection patterns - Timing patterns - Dark dot at the left bottom corner - Position adjustment patterns, if need be The version. The matrix. Embed type information. On success, modify the matrix. The ec level. The mask pattern. The matrix. Embed version information if need be. On success, modify the matrix and return true. See 8.10 of JISX0510:2004 (p.47) for how to embed version information. The version. The matrix. Embed "dataBits" using "getMaskPattern". On success, modify the matrix and return true. For debugging purposes, it skips masking process if "getMaskPattern" is -1. See 8.7 of JISX0510:2004 (p.38) for how to embed data bits. The data bits. The mask pattern. The matrix. Return the position of the most significant bit set (to one) in the "value". The most significant bit is position 32. If there is no bit set, return 0. Examples: - findMSBSet(0) => 0 - findMSBSet(1) => 1 - findMSBSet(255) => 8 The value_ renamed. Calculate BCH (Bose-Chaudhuri-Hocquenghem) code for "value" using polynomial "poly". The BCH code is used for encoding type information and version information. Example: Calculation of version information of 7. f(x) is created from 7. - 7 = 000111 in 6 bits - f(x) = x^2 + x^2 + x^1 g(x) is given by the standard (p. 67) - g(x) = x^12 + x^11 + x^10 + x^9 + x^8 + x^5 + x^2 + 1 Multiply f(x) by x^(18 - 6) - f'(x) = f(x) * x^(18 - 6) - f'(x) = x^14 + x^13 + x^12 Calculate the remainder of f'(x) / g(x) x^2 __________________________________________________ g(x) )x^14 + x^13 + x^12 x^14 + x^13 + x^12 + x^11 + x^10 + x^7 + x^4 + x^2 -------------------------------------------------- x^11 + x^10 + x^7 + x^4 + x^2 The remainder is x^11 + x^10 + x^7 + x^4 + x^2 Encode it in binary: 110010010100 The return value is 0xc94 (1100 1001 0100) Since all coefficients in the polynomials are 1 or 0, we can do the calculation by bit operations. We don't care if coefficients are positive or negative. The value. The poly. Make bit vector of type information. On success, store the result in "bits" and return true. Encode error correction level and mask pattern. See 8.9 of JISX0510:2004 (p.45) for details. The ec level. The mask pattern. The bits. Make bit vector of version information. On success, store the result in "bits" and return true. See 8.10 of JISX0510:2004 (p.45) for details. The version. The bits. Check if "value" is empty. The value. true if the specified value is empty; otherwise, false. Embed the lonely dark dot at left bottom corner. JISX0510:2004 (p.46) The matrix. The x start. The y start. The matrix. Embed position detection patterns and surrounding vertical/horizontal separators. The matrix. Embed position adjustment patterns if need be. The version. The matrix. * Encoder that encodes minimally * * Algorithm: * * The eleventh commandment was "Thou Shalt Compute" or "Thou Shalt Not Compute" - I forget which(Alan Perilis). * * This implementation computes.As an alternative, the QR-Code specification suggests heuristics like this one: * * If initial input data is in the exclusive subset of the Alphanumeric character set AND if there are less than * [6,7,8] characters followed by data from the remainder of the 8-bit byte character set, THEN select the 8- * bit byte mode ELSE select Alphanumeric mode; * * This is probably right for 99.99% of cases but there is at least this one counter example: The string "AAAAAAa" * encodes 2 bits smaller as ALPHANUMERIC(AAAAAA), BYTE(a) than by encoding it as BYTE(AAAAAAa). * Perhaps that is the only counter example but without having proof, it remains unclear. * * ECI switching: * * In multi language content the algorithm selects the most compact representation using ECI modes. * For example the most compact representation of the string "\u0150\u015C" (O-double-acute, S-circumflex) is * ECI(UTF-8), BYTE(\u0150\u015C) while prepending one or more times the same leading character as in * "\u0150\u0150\u015C", the most compact representation uses two ECIs so that the string is encoded as * ECI(ISO-8859-2), BYTE(\u0150\u0150), ECI(ISO-8859-3), BYTE(\u015C). * * @author Alex Geller Creates a MinimalEncoder The string to encode The preferred . When the value of the argument is null, the algorithm * chooses charsets that leads to a minimal representation.Otherwise the algorithm will use the priority * charset to encode any character in the input that can be encoded by it if the charset is among the * supported charsets. {@code true} if a FNC1 is to be prepended; {@code false} otherwise The error correction level. Encodes the string minimally The string to encode The preferred . A minimal version is computed(see {@link ResultList#getVersion method} when the value of the argument is null The preferred { @link Charset}. When the value of the argument is null, the algorithm chooses charsets that leads to a minimal representation.Otherwise the algorithm will use the priority charset to encode any character in the input that can be encoded by it if the charset is among the supported charsets. { @code true} if a FNC1 is to be prepended;{ @code false}otherwise The error correction level. An instance of { @code ResultList} representing the minimal solution. @see ResultList#getBits @see ResultList#getVersion @see ResultList#getSize returns the size in bits appends the bits returns the size in bits returns the length in characters according to the specification (differs from getCharacterLength() in BYTE mode for multi byte encoded characters) appends the bits satorux@google.com (Satoru Takabayashi) - creator dswitkin@google.com (Daniel Switkin) - ported from C++ Initializes a new instance of the class. Gets or sets the mode, not relevant if is selected. The mode. Gets or sets the EC level. The EC level. Gets or sets the version. The version. Gets or sets the mask pattern. The mask pattern. Gets or sets the matrix. The matrix. Returns a that represents this instance. A that represents this instance. Check if "mask_pattern" is valid. The mask pattern. true if [is valid mask pattern] [the specified mask pattern]; otherwise, false. The class holds the available options for the QrCodeWriter Specifies what degree of error correction to use, for example in QR Codes. Type depends on the encoder. For example for QR codes it's type . Specifies what character encoding to use where applicable (type ) Explicitly disables ECI segment when generating QR Code That is against the specification of QR Code but some readers have problems if the charset is switched from ISO-8859-1 (default) to UTF-8 with the necessary ECI segment. If you set the property to true you can use UTF-8 encoding and the ECI segment is omitted. Specifies the exact version of QR code to be encoded. An integer, range 1 to 40. If the data specified cannot fit within the required version, a WriterException will be thrown. Specifies whether to use compact mode for QR code (type , or "true" or "false" Please note that when compaction is performed, the most compact character encoding is chosen for characters in the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by means of the encoding hint. This implementation can detect and decode QR Codes in an image. Sean Owen Gets the decoder. Locates and decodes a QR code in an image. a String representing the content encoded by the QR code Locates and decodes a barcode in some format within an image. This method also accepts hints, each possibly associated to some data, which may help the implementation decode. image of barcode to decode passed as a from to arbitrary data. The meaning of the data depends upon the hint type. The implementation may or may not do anything with these hints. String which the barcode encodes Resets any internal state the implementation has after a decode, to prepare it for reuse. This method detects a code in a "pure" image -- that is, pure monochrome image which contains only an unrotated, unskewed, image of a code, with some white border around it. This is a specialized method that works exceptionally fast in this special case. This object renders a QR Code as a BitMatrix 2D array of greyscale values. dswitkin@google.com (Daniel Switkin) Encode a barcode using the default settings. The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white) The contents to encode in the barcode The barcode format to generate The preferred width in pixels The preferred height in pixels Additional parameters to supply to the encoder The generated barcode as a Matrix of unsigned bytes (0 == black, 255 == white)