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
¶ The bounding box around the detected barcode.
- Return type
ndarray
-
property
barcode_type
¶ The type of detected barcode. Supported - [‘None’, ‘EAN_8’, ‘EAN_13’, ‘UPC_A’, ‘UPC_E’, ‘UPC_EAN_EXTENSION’]
- Return type
str
-
property
info
¶ The extracted barcode information
- Return type
str
-
class
BarcodeDetectionResults
(predictions, image)¶ All the results of barcode detection from
BarcodeDetection
.- Parameters
predictions (
List
[BarcodeDetectionPrediction
]) – The boxes, type and info for each prediction(detection).image (
ndarray
) – The image that the detection was performed on.
-
property
predictions
¶ The list of predictions.
- Return type
-
property
image
¶ The image the results were processed on.
- Return type
ndarray
-
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
-
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
image (
ndarray
) – The image on whichBarcodeDetection.localize()
was used to obtain the boxes.boxes (
ndarray
) – The localized barcode boxes returned byBarcodeDetection.localize()
.
- Return type
-
publish_analytics
(results, tag=None, **kwargs)¶ Publish Barcode Detection results to the alwaysAI Analytics Service
- Parameters
results (
BarcodeDetectionResults
) – The results to publish.tag (
Optional
[Any
]) – Additional information to assist in querying and visualizations.
- 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.
-