BarcodeDetection

class BarcodeDetectionPrediction(box, barcode_type, info)

A single prediction from BarcodeDetection.

property box

The bounding box around the detected barcode.

Type

numpy array

property barcode_type

The type of detected barcode. Supported - [‘None’, ‘EAN_8’, ‘EAN_13’, ‘UPC_A’, ‘UPC_E’, ‘UPC_EAN_EXTENSION’]

Type

string

property info

The extracted barcode information

Type

string

class BarcodeDetectionResults(predictions, image)

All the results of barcode detection from BarcodeDetection.

property predictions

The list of predictions.

Type

list of BarcodeDetectionPrediction

property image

The image the results were processed on.

Type

numpy array – The image in BGR format

markup_image()

Draw detected barcode boxes on the image.

Returns

numpy array – The marked-up image

crop_localized()

Crop the detected barcode boxes from the image.

Returns

list – Cropped barcode images

class BarcodeDetection

Locate, detect and decode the barcode(s) within an image.

Typical usage:

barcode_detector = edgeiq.BarcodeDetection()

<get image>
results = barcode_detector.localize_decode(image)
image = results.markup_image()

for prediction in results.predictions:
    text.append("{}: {}".format(
                prediction.barcode_type, prediction.info))
localize_decode(image)

Localizes and decodes barcodes in an image.

Parameters

image (numpy array of image in BGR format) – The image to analyze.

Returns

BarcodeDetectionResults

localize(image)

Localize barcode(s) within an image.

Parameters

image (numpy array of image in BGR format) – The image to analyze.

Returns

numpy array – Boxes around localized barcodes

decode(image, boxes)

Decodes localized barcode(s).

Parameters
Returns

BarcodeDetectionResults

publish_analytics(results, tag=None)

Publish Barcode Detection results to the alwaysAI Analytics Service

Parameters
  • results (BarcodeDetectionResults) – The results to publish.

  • tag (JSON-serializable object) – Additional information to assist in querying and visualizations.