Recognize Barcodes

Recognize barcodes in video

Overview

The Recognize Barcodes node decodes barcodes detected by an AI model, and adds metadata to the frame metadata.

Suggested use : AI Model Node (with Barcode model) -> Track Objects Node -> Recognize Barcodes Node

Inputs & Outputs

  • Inputs : 1, Media Format : Raw Video
  • Outputs : 1, Media Format: Raw Video
  • Output Metadata : Barcode Information

Properties

PropertyDescriptionTypeDefaultRequired
barcode_typesComma-separated list of barcode types to recognize. Options: aztec, codabar, code128, code39, code93, composite, datamatrix, databar, databar_exp, ean2, ean5, ean8, ean13, i25, isbn10, isbn13, maxicode, partial, pdf417, qrcode, microqrcode, rmqrcode, upca, upce, linearcodes, matrixcodes. Leave empty to detect all types.enum-multinullNo
display_infoDisplay barcode info on video?booltrueNo
preprocessApply image preprocessing. Options: upscale (if too small), downscale (if too big), sharpen, rotate (attempt to straighten).enum-multinullNo
process_detected_barcodes_onlyProcess detected barcodes only? Disable to scan entire image for barcodes and increase processing time. Useful if the model doesn't detect barcodes well.booltrueNo
barcode_engineSelect a barcode decoding engine. Options: zxing, zbar.enumzxingYes
retention_durationDuration (seconds) to remember barcodes. After this interval, a barcode that was seen previously will be treated as a new barcode.float60No

Metadata

Metadata PropertyDescription
nodes.<node_id>Describes Barcode information for any decoded barcodes.
Format: as defined in the table below.

<node_id> for Recognize Barcode Nodes is of the form annotate_barcodeX (ex. annotate_barcode1)

Example

"nodes": {
    "annotate_barcode1": {
        "type": "annotate_barcode",
        "barcodes" : [
          { 
            "type": "EAN13",
            "data": "124314072131",
            "coords": [104,205,100,300],
            "id": 1203112309710239
          },
          { 
            "type": "CODE128",
            "data": "203927812",
            "coords": [410,445,120,340],
            "id": 102397932481
          }          
        ],
        "barcode_count": 2,
        "barcode_count_delta": 1
    }
}

Format

KeyTypeDescription
barcodesArrayTrue if motion is currently detected, else False
barcodes[].typeEnumType of recognized barcode. One of the supported barcode_types values.
barcodes[].dataStringContents of the Barcode
barcodes[].coordsArrayWhere in the image the barcode is detected. Format: [x,y,width,height]
barcodes[].idLong IntegerUnique tracking ID for the detected barcode if a tracker is used and process_detected_barcodes_only is set to True. Else -1.
barcode_countIntegerNumber of barcodes recognized.
barcode_count_deltaIntegerNumber of new barcodes recognized in this frame.

Objects metadata augmentation

The following information is added to the detected object's "attributes" array:

"class_id" field"label" field"probability" field
11000The recognized barcode result (string)The barcode recognition confidence
11001The recognized barcode type (string)The barcode recognition confidence
"objects": [{
    "id": 5750484150146564100,
    "label": "barcode",
    "class_id": 0,
    "probability": 0.98,
    "rect": {
        "width": 47,
        "top": 201,
        "left": 656,
        "height": 25.
    },
    "attributes": [{
        "label": "124314072131",
        "class_id": 11000,
        "probability": 1.0,
    },
    {
        "label": "EAN13",
        "class_id": 11001,
        "probability": 1.0,
    }]
}]