Barcode Xpress for Linux v13.1 - Updated
AnalyzeOpenCV
API Reference > BarcodeXpress.py Reference > BarcodeXpress.py Functions Reference > AnalyzeOpenCV

Searches for barcodes in a bitmap returned from OpenCV.

Declaration:

Copy Code
AnalyzeOpenCV(image, options = {})

Arguments:

image

An image loaded or processed by OpenCV.

options A dictionary containing optional parameters for the scan. See Options below for valid options and their default values.

Return Value: 

Returns a list of Barcode objects representing barcodes detected on the passed image.

Options

String Key

Option Type

Description

AppendCheckSum

boolean

Specifies if a checksum value is appended to the barcode during recognition. 

If this property is set to true, checksum values will be appended to the result for barcode types that require a checksum. 

This property does not have an effect on barcode types which do not have a checksum or for which the checksum is optional. 

The UPC and EAN codes always append the checksum character to the barcode results.

This is done regardless of this property's value. 

The default value is False.

Area

Rectangle

Specifies the area of an image to analyze for barcode recognition.

To search the entire image, all of the values must be set to 0.

If any value is set, then they must all be set.

The default value is {0,0,0,0}.

BarcodeTypes

BarcodeType

A list which specifies the types of barcodes to search during the recognition process.

By default the barcode types set are [ BarcodeType.Unknown ] which causes the engine to search for all 1D barcodes. The 1D barcode set includes all types, except PatchCode, PostNet,

GS1 DataBar, IntelligentMail, Royal Post Mail 4-State,

Australian Post 4-State, QR Code, PDF417, MicroPDF417, Aztec and Data Matrix.

IncludeControlCharacters

boolean

Specifies if control characters are added to the barcode value.

If this property is set to True, the barcode control characters are included in the barcode read value. This has no effect for barcodes which do not support control characters.

InkColor

InkColor

Specifies what color of the barcode to search for.

The default value is InkColor.Black

MaximumBarcodes

integer

Specifies the maximum number of barcodes to return.

If more than this number of barcodes is found in the image, then the barcode engine will return the number of barcodes specified.

The minimum value is 1.

The default value is 100.

MinimumBarcodeSize

integer

Specifies the minimum size of a barcode to return.

Setting this value to 0 indicates that any size barcode should be returned.

Any of the 4 edges of a barcode may pass this minimum size test to be returned (eg. A MinimumBarcodeSize of 100 would return a barcode with edge-lengths of [80, 85, 90, 100] because the fourth edge length is greater-than-or-equal to the minimum size). 

The default value is 0.

Orientation

Orientation

Specifies which direction to search for a barcode on the image.

Set this value to expand or limit which direction to search for a barcode.

For example, to only find barcodes that are oriented vertically set this to Orientation.Vertical

Any barcodes that are oriented horizontally or diagonally will not be returned.

The default value is Orientation.HorizontalVertical.

ReturnPossibleBarcodes

boolean

Specifies if the barcode engine should return possible barcodes.

When this property is set to True, the barcode engine returns candidate barcodes which could not be decoded in the results list.

The default value is False.

ScanDistance

integer

Specifies the scan distance in pixels between line sweeps when searching for 1D barcodes.

The default value is 5. 

Valid values are 1 up to and including 10.

GrayscaleProcessing

boolean

Enables the direct analysis of grayscale image processing.

When this value is set to True, the barcode engine will process a grayscale image along with a binarized version of the image. This step is strictly an extra analysis step.

The default value is False.

AdditionalReadingPass

boolean

Enables additional scaled (reduced) image processing.

When this value is set to True, the barcode engine will reduce the original image and perform additional processing pass.

After analyzing both these images, results from the second pass that are not present in the first pass will be reported.

This step is strictly an extra analysis step which increases response time.

It can be used for barcode images with repetitive noise artifacts around the bars which cause normal recognition pass to misread.

The default value is False.