Class BarcodeItem
-
- All Implemented Interfaces:
-
android.os.Parcelable,java.lang.AutoCloseable
public final class BarcodeItem implements AutoCloseable, Parcelable
A single barcode found in the input image. Barcodes with the same content but different locations in the image are considered separate barcodes.
-
-
Field Summary
Fields Modifier and Type Field Description private final Stringtextprivate final BarcodeFormatformatprivate final List<Point>quadprivate final List<PointF>quadNormalizedprivate final BooleanisUpsideDownprivate final ImageRefsourceImageprivate final ByteArrayrawBytesprivate final StringupcEanExtensionprivate final BooleanisGS1Messageprivate final BooleanisGS1CompositePartprivate final IntegerdataBarStackSizeprivate final DoublesizeScoreprivate final GenericDocumentextractedDocument
-
Constructor Summary
Constructors Constructor Description BarcodeItem(Map<String, Object> source)BarcodeItem(JSONObject json)BarcodeItem(String text, BarcodeFormat format, List<Point> quad, List<PointF> quadNormalized, Boolean isUpsideDown, ImageRef sourceImage, ByteArray rawBytes, String upcEanExtension, Boolean isGS1Message, Boolean isGS1CompositePart, Integer dataBarStackSize, Double sizeScore, GenericDocument extractedDocument)
-
Method Summary
Modifier and Type Method Description final StringgetText()Text contained in the barcode. final BarcodeFormatgetFormat()Barcode format. final List<Point>getQuad()The four corners of the barcode in the input image, in clockwise order starting from the top left, in image coordinates. final List<PointF>getQuadNormalized()The four corners of the barcode in the input image, in clockwise order starting from the top left, normalized to the range 0, 1. final BooleanisUpsideDown()True if this is a 1D barcode that is printed upside-down, that is, the barcode was scanned right-to-left. final ImageRefgetSourceImage()A crop from the input image containing the barcode. final ByteArraygetRawBytes()Raw bytes of barcode contents. final StringgetUpcEanExtension()If this is a UPC/EAN barcode that has an EAN-2 or EAN-5 extension, this field contains the extension value. final BooleanisGS1Message()True if the barcode contains a GS1 message. final BooleanisGS1CompositePart()True if this result is the 2D part of a GS1 Composite barcode. final IntegergetDataBarStackSize()The number of 1D stacks in the barcode. final DoublegetSizeScore()The size score is a floating point value between 0 and 1 that represents the relative size of the barcode in the input image. final GenericDocumentgetExtractedDocument()The parsed known document format (if parsed successfully). final JSONObjecttoJson(ToJsonConfiguration config)final BarcodeItemclone()Unitclose()-
-
Constructor Detail
-
BarcodeItem
BarcodeItem(JSONObject json)
-
BarcodeItem
BarcodeItem(String text, BarcodeFormat format, List<Point> quad, List<PointF> quadNormalized, Boolean isUpsideDown, ImageRef sourceImage, ByteArray rawBytes, String upcEanExtension, Boolean isGS1Message, Boolean isGS1CompositePart, Integer dataBarStackSize, Double sizeScore, GenericDocument extractedDocument)
-
-
Method Detail
-
getText
final String getText()
Text contained in the barcode. Binary data is returned in the rawBytes field only.
-
getFormat
final BarcodeFormat getFormat()
Barcode format.
Default is NONE
-
getQuad
final List<Point> getQuad()
The four corners of the barcode in the input image, in clockwise order starting from the top left, in image coordinates.
-
getQuadNormalized
final List<PointF> getQuadNormalized()
The four corners of the barcode in the input image, in clockwise order starting from the top left, normalized to the range 0, 1.
-
isUpsideDown
final Boolean 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
-
getSourceImage
final ImageRef getSourceImage()
A crop from the input image containing the barcode.
-
getRawBytes
final ByteArray getRawBytes()
Raw bytes of barcode contents. Some formats can contain binary data, which is returned in this field.
-
getUpcEanExtension
final String getUpcEanExtension()
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
final Boolean isGS1Message()
True if the barcode contains a GS1 message. Requires GS1 handling to be enabled in the decoding option.
Default is false
-
isGS1CompositePart
final Boolean 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
-
getDataBarStackSize
final Integer getDataBarStackSize()
The number of 1D stacks in the barcode. Applies only to DATABAR and DATABAR_EXPANDED barcodes.
Default is 1
-
getSizeScore
final Double getSizeScore()
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
-
getExtractedDocument
final GenericDocument getExtractedDocument()
The parsed known document format (if parsed successfully).
-
toJson
final JSONObject toJson(ToJsonConfiguration config)
-
clone
final BarcodeItem clone()
-
-
-
-