BarcodeDetection

class BarcodeDetectionPrediction(box, barcode_type, info)

A single prediction from BarcodeDetection.

Parameters:
  • box (ndarray) – The vertices of the detected barcode.

  • barcode_type (str) – The type of barcode. Supported: [‘None’, ‘EAN_8’, ‘EAN_13’, ‘UPC_A’, ‘UPC_E’, ‘UPC_EAN_EXTENSION’]

  • info (str) – The decoded barcode information

property box: ndarray

The bounding box around the detected barcode.

property barcode_type: str

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

property info: str

The extracted barcode information

class BarcodeDetectionResults(predictions, image)

All the results of barcode detection from BarcodeDetection.

Parameters:
property predictions: List[BarcodeDetectionPrediction]

The list of predictions.

property image: ndarray

The image the results were processed on.

markup_image()

Draw detected barcode boxes on the image.

Return type:

ndarray

Returns:

The marked-up image

crop_localized()

Crop the detected barcode boxes from the image.

Return type:

List[ndarray]

Returns:

The list of 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 (ndarray) – The image to analyze.

Return type:

BarcodeDetectionResults

localize(image)

Localize barcode(s) within an image.

Parameters:

image (ndarray) – The image to analyze in BGR format.

Return type:

ndarray

Returns:

The boxes around localized barcodes

decode(image, boxes)

Decodes localized barcode(s).

Parameters:
Return type:

BarcodeDetectionResults

publish_analytics(results, tag=None, **kwargs)

Publish Barcode Detection results to the alwaysAI Analytics Service

Example usage:

try:
    barcode_detector.publish_analytics(results, tag='custom_tag')
except edgeiq.PublishError as e:
    # Retry publish
except edgeiq.ConnectionError as e:
    # Save state and exit app to reconnect
Parameters:
Raises:

ConnectionBlockedError when using connection to the alwaysAI Device Agent and resources are at capacity,

Raises:

PacketRateError when publish rate exceeds current limit,

Raises:

PacketSizeError when packet size exceeds current limit. Packet publish size and rate limits will be provided in the error message.