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

PropertyValue
barcode_typesComma separated list of barcode types to recognize. Empty will search for all types.

Options:
codabar,code128,code39,code93,composite,databar,databar_exp,ean13,ean2,ean5,ean8,i25,isbn10,isbn13,pdf417,qrcode,upca,upce
preprocessEnables preprocessing to enhance image quality, which might improve detection rates.

Options:
none : Disabled
upscale : Upscale detected barcode upscale.sharpen : Upscale + Apply image sharpening. Helps if barcodes are blurry.
upscale.sharpen.rotate : Upscale + Sharpen + Autorotate.
display_info Boolean. If true, detected Barcode info will be drawn on video

Ex. true / false
process_detected_barcodes_onlyEnable to only process barcodes detected by a prior model inference node. Turning off scans entire image for barcodes, and increases processing time but may be useful if the model doesn't detect barcodes well.

Ex. true / false

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
10100The recognized barcode result (string)The barcode recognition confidence
10101The 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": 10100,
        "probability": 1.0,
    },
    {
        "label": "EAN13",
        "class_id": 10101,
        "probability": 1.0,
    }]
}]