Package io.scanbot.sdk.barcode
Class BarcodeItem
java.lang.Object
io.scanbot.sdk.barcode.BarcodeItem
- All Implemented Interfaces:
AutoCloseable
A single barcode found in the input image. Barcodes with the same content but different locations in the image are considered separate barcodes.
-
Constructor Summary
ConstructorsConstructorDescriptionBarcodeItem(BarcodeFormat format, String text, byte[] rawBytes, List<RangeEncoding> rawBytesEncodings, StructuredAppendInfo structuredAppendInfo, List<Point> quad, List<PointF> quadNormalized, List<Point> extendedQuad, List<PointF> extendedQuadNormalized, boolean isUpsideDown, ImageRef sourceImage, String upcEanExtension, boolean isGS1Message, boolean isGS1CompositePart, int dataBarStackSize, double sizeScore, GenericDocument extractedDocument, int globalIndex) Constructs BarcodeItem with the given params.BarcodeItem(String text, byte[] rawBytes, List<RangeEncoding> rawBytesEncodings, StructuredAppendInfo structuredAppendInfo, List<Point> quad, List<PointF> quadNormalized, List<Point> extendedQuad, List<PointF> extendedQuadNormalized, String upcEanExtension, GenericDocument extractedDocument) Constructs BarcodeItem with default parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes native resources (images) held by the object.intGetter for dataBarStackSize field.Getter for extendedQuad field.Getter for extendedQuadNormalized field.Getter for extractedDocument field.Getter for format field.intGetter for globalIndex field.getQuad()Getter for quad field.Getter for quadNormalized field.byte[]Getter for rawBytes field.Getter for rawBytesEncodings field.doubleGetter for sizeScore field.Getter for sourceImage field.Getter for structuredAppendInfo field.getText()Getter for text field.Getter for upcEanExtension field.booleanGetter for isGS1CompositePart field.booleanGetter for isGS1Message field.booleanGetter for isUpsideDown field.
-
Constructor Details
-
BarcodeItem
public BarcodeItem(BarcodeFormat format, String text, byte[] rawBytes, List<RangeEncoding> rawBytesEncodings, StructuredAppendInfo structuredAppendInfo, List<Point> quad, List<PointF> quadNormalized, List<Point> extendedQuad, List<PointF> extendedQuadNormalized, boolean isUpsideDown, ImageRef sourceImage, String upcEanExtension, boolean isGS1Message, boolean isGS1CompositePart, int dataBarStackSize, double sizeScore, GenericDocument extractedDocument, int globalIndex) Constructs BarcodeItem with the given params.- Parameters:
format- Barcode format. Default is `NONE`.text- Text contained in the barcode. Binary data is returned in the rawBytes field only.rawBytes- Raw bytes of barcode contents. Some barcode formats are able to encode binary data. If a barcode contains binary data, it's provided as a list of bytes in the rawBytes field. Some barcode formats additionally allow pieces of the data within to have different encodings - UTF-8, ASCII, binary, etc. The rawBytesEncodings field lists the encoding of each range in the rawBytes array. For barcode formats that contain a GS1 message (e.g. GS1 Composite), we recommend to use a GS1Handling and extract the GS1 message from the text.rawBytesEncodings- Encoding information for the rawBytes field. Each element of this list covers some portion of the rawBytes array. Taken together, the elements of the list cover the entirety of the rawBytes array without overlap and without holes. The elements are ordered in increasing order of the start and end indices.structuredAppendInfo- If this barcode is part of a structured append sequence, this field contains information about the sequence.quad- The four corners of the barcode in the input image, in clockwise order starting from the top left, in image coordinates.quadNormalized- The four corners of the barcode in the input image, in clockwise order starting from the top left, normalized to the range [0, 1].extendedQuad- As quad, but extended to appropriate height for oned barcodes.extendedQuadNormalized- As quadNormalized, but extended to appropriate height for oned barcodes.isUpsideDown- True if this is a 1D barcode that is printed upside-down, that is, the barcode was scanned right-to-left. Default is `false`.sourceImage- A crop from the input image containing the barcode.upcEanExtension- If this is a UPC/EAN barcode that has an EAN-2 or EAN-5 extension, this field contains the extension value. Requires the UPC_EAN_EXTENSION format to be enabled in the decoding options.isGS1Message- True if the barcode contains a GS1 message. Requires GS1 handling to be enabled in the decoding option. Default is `false`.isGS1CompositePart- True if this result is the 2D part of a GS1 Composite barcode. Can only happen if GS1_COMPOSITE scanning is disabled and a part of the composite (1D) or (2D) is scanned separately. When GS1_COMPOSITE scanning is enabled, parts of the composite barcode are never returned separately, even if their respective format is enabled in the decoding options. Default is `false`.dataBarStackSize- The number of 1D stacks in the barcode. Applies only to DATABAR and DATABAR_EXPANDED barcodes. Default is `1`.sizeScore- The size score is a floating point value between 0 and 1 that represents the relative size of the barcode in the input image. Barcodes taking up a small portion of the input image will have a score close to 0, while barcodes that take a large portion will have a score close to 1. Default is `0`.extractedDocument- The parsed known document format (if parsed successfully).globalIndex- The index of the barcode to uniquely identify it. In case of frame accumulation, the index remains the same across frames. Default is `-1`.
-
BarcodeItem
public BarcodeItem(String text, byte[] rawBytes, List<RangeEncoding> rawBytesEncodings, StructuredAppendInfo structuredAppendInfo, List<Point> quad, List<PointF> quadNormalized, List<Point> extendedQuad, List<PointF> extendedQuadNormalized, String upcEanExtension, GenericDocument extractedDocument) Constructs BarcodeItem with default parameters.- Parameters:
text- Text contained in the barcode. Binary data is returned in the rawBytes field only.rawBytes- Raw bytes of barcode contents. Some barcode formats are able to encode binary data. If a barcode contains binary data, it's provided as a list of bytes in the rawBytes field. Some barcode formats additionally allow pieces of the data within to have different encodings - UTF-8, ASCII, binary, etc. The rawBytesEncodings field lists the encoding of each range in the rawBytes array. For barcode formats that contain a GS1 message (e.g. GS1 Composite), we recommend to use a GS1Handling and extract the GS1 message from the text.rawBytesEncodings- Encoding information for the rawBytes field. Each element of this list covers some portion of the rawBytes array. Taken together, the elements of the list cover the entirety of the rawBytes array without overlap and without holes. The elements are ordered in increasing order of the start and end indices.structuredAppendInfo- If this barcode is part of a structured append sequence, this field contains information about the sequence.quad- The four corners of the barcode in the input image, in clockwise order starting from the top left, in image coordinates.quadNormalized- The four corners of the barcode in the input image, in clockwise order starting from the top left, normalized to the range [0, 1].extendedQuad- As quad, but extended to appropriate height for oned barcodes.extendedQuadNormalized- As quadNormalized, but extended to appropriate height for oned barcodes.upcEanExtension- If this is a UPC/EAN barcode that has an EAN-2 or EAN-5 extension, this field contains the extension value. Requires the UPC_EAN_EXTENSION format to be enabled in the decoding options.extractedDocument- The parsed known document format (if parsed successfully).
-
-
Method Details
-
getFormat
Getter for format field. See constructor documentation for more information about the field.- Returns:
- format
-
getText
Getter for text field. See constructor documentation for more information about the field.- Returns:
- text
-
getRawBytes
public byte[] getRawBytes()Getter for rawBytes field. See constructor documentation for more information about the field.- Returns:
- rawBytes
-
getRawBytesEncodings
Getter for rawBytesEncodings field. See constructor documentation for more information about the field.- Returns:
- rawBytesEncodings
-
getStructuredAppendInfo
Getter for structuredAppendInfo field. See constructor documentation for more information about the field.- Returns:
- structuredAppendInfo
-
getQuad
Getter for quad field. See constructor documentation for more information about the field.- Returns:
- quad
-
getQuadNormalized
Getter for quadNormalized field. See constructor documentation for more information about the field.- Returns:
- quadNormalized
-
getExtendedQuad
Getter for extendedQuad field. See constructor documentation for more information about the field.- Returns:
- extendedQuad
-
getExtendedQuadNormalized
Getter for extendedQuadNormalized field. See constructor documentation for more information about the field.- Returns:
- extendedQuadNormalized
-
isUpsideDown
public boolean isUpsideDown()Getter for isUpsideDown field. See constructor documentation for more information about the field.- Returns:
- isUpsideDown
-
getSourceImage
Getter for sourceImage field. See constructor documentation for more information about the field.- Returns:
- sourceImage
-
getUpcEanExtension
Getter for upcEanExtension field. See constructor documentation for more information about the field.- Returns:
- upcEanExtension
-
isGS1Message
public boolean isGS1Message()Getter for isGS1Message field. See constructor documentation for more information about the field.- Returns:
- isGS1Message
-
isGS1CompositePart
public boolean isGS1CompositePart()Getter for isGS1CompositePart field. See constructor documentation for more information about the field.- Returns:
- isGS1CompositePart
-
getDataBarStackSize
public int getDataBarStackSize()Getter for dataBarStackSize field. See constructor documentation for more information about the field.- Returns:
- dataBarStackSize
-
getSizeScore
public double getSizeScore()Getter for sizeScore field. See constructor documentation for more information about the field.- Returns:
- sizeScore
-
getExtractedDocument
Getter for extractedDocument field. See constructor documentation for more information about the field.- Returns:
- extractedDocument
-
getGlobalIndex
public int getGlobalIndex()Getter for globalIndex field. See constructor documentation for more information about the field.- Returns:
- globalIndex
-
close
public void close()Closes native resources (images) held by the object.- Specified by:
closein interfaceAutoCloseable
-