ClassesClassesClassesClasses | | | | Operators

decode_bar_code_rectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2DecodeBarCodeRectangle2 (Operator)

Name

decode_bar_code_rectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2DecodeBarCodeRectangle2 — Decode bar code symbols within a rectangle.

Signature

decode_bar_code_rectangle2(Image : : BarCodeHandle, CodeType, Row, Column, Phi, Length1, Length2 : DecodedDataStrings)

Herror decode_bar_code_rectangle2(const Hobject Image, const Hlong BarCodeHandle, const char* CodeType, double Row, double Column, double Phi, double Length1, double Length2, char* DecodedDataStrings)

Herror T_decode_bar_code_rectangle2(const Hobject Image, const Htuple BarCodeHandle, const Htuple CodeType, const Htuple Row, const Htuple Column, const Htuple Phi, const Htuple Length1, const Htuple Length2, Htuple* DecodedDataStrings)

Herror decode_bar_code_rectangle2(Hobject Image, const HTuple& BarCodeHandle, const HTuple& CodeType, const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2, char* DecodedDataStrings)

Herror decode_bar_code_rectangle2(Hobject Image, const HTuple& BarCodeHandle, const HTuple& CodeType, const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2, HTuple* DecodedDataStrings)

HTuple HImage::DecodeBarCodeRectangle2(const HBarCode& BarCodeHandle, const HTuple& CodeType, const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2) const

HTuple HBarCode::DecodeBarCodeRectangle2(const HImage& Image, const HTuple& CodeType, const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2) const

void DecodeBarCodeRectangle2(const HObject& Image, const HTuple& BarCodeHandle, const HTuple& CodeType, const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2, HTuple* DecodedDataStrings)

HTuple HBarCode::DecodeBarCodeRectangle2(const HImage& Image, const HTuple& CodeType, const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2) const

HString HBarCode::DecodeBarCodeRectangle2(const HImage& Image, const HString& CodeType, double Row, double Column, double Phi, double Length1, double Length2) const

HString HBarCode::DecodeBarCodeRectangle2(const HImage& Image, const char* CodeType, double Row, double Column, double Phi, double Length1, double Length2) const

HTuple HImage::DecodeBarCodeRectangle2(const HBarCode& BarCodeHandle, const HTuple& CodeType, const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2) const

HString HImage::DecodeBarCodeRectangle2(const HBarCode& BarCodeHandle, const HString& CodeType, double Row, double Column, double Phi, double Length1, double Length2) const

HString HImage::DecodeBarCodeRectangle2(const HBarCode& BarCodeHandle, const char* CodeType, double Row, double Column, double Phi, double Length1, double Length2) const

void HOperatorSetX.DecodeBarCodeRectangle2(
[in] IHUntypedObjectX* Image, [in] VARIANT BarCodeHandle, [in] VARIANT CodeType, [in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Phi, [in] VARIANT Length1, [in] VARIANT Length2, [out] VARIANT* DecodedDataStrings)

VARIANT HBarCodeX.DecodeBarCodeRectangle2(
[in] IHImageX* Image, [in] VARIANT CodeType, [in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Phi, [in] VARIANT Length1, [in] VARIANT Length2)

VARIANT HImageX.DecodeBarCodeRectangle2(
[in] IHBarCodeX* BarCodeHandle, [in] VARIANT CodeType, [in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Phi, [in] VARIANT Length1, [in] VARIANT Length2)

static void HOperatorSet.DecodeBarCodeRectangle2(HObject image, HTuple barCodeHandle, HTuple codeType, HTuple row, HTuple column, HTuple phi, HTuple length1, HTuple length2, out HTuple decodedDataStrings)

HTuple HBarCode.DecodeBarCodeRectangle2(HImage image, HTuple codeType, HTuple row, HTuple column, HTuple phi, HTuple length1, HTuple length2)

string HBarCode.DecodeBarCodeRectangle2(HImage image, string codeType, double row, double column, double phi, double length1, double length2)

HTuple HImage.DecodeBarCodeRectangle2(HBarCode barCodeHandle, HTuple codeType, HTuple row, HTuple column, HTuple phi, HTuple length1, HTuple length2)

string HImage.DecodeBarCodeRectangle2(HBarCode barCodeHandle, string codeType, double row, double column, double phi, double length1, double length2)

Description

The operator decode_bar_code_rectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2DecodeBarCodeRectangle2 uses the bar code model specified by BarCodeHandleBarCodeHandleBarCodeHandleBarCodeHandleBarCodeHandlebarCodeHandle to decode a bar code at a given position within the image ImageImageImageImageImageimage. BarCodeHandleBarCodeHandleBarCodeHandleBarCodeHandleBarCodeHandlebarCodeHandle must be created with create_bar_code_modelcreate_bar_code_modelCreateBarCodeModelcreate_bar_code_modelCreateBarCodeModelCreateBarCodeModel, its parameters can be set with set_bar_code_paramset_bar_code_paramSetBarCodeParamset_bar_code_paramSetBarCodeParamSetBarCodeParam. The position of the bar code is given as an arbitrarily oriented rectangle. Contrary to find_bar_codefind_bar_codeFindBarCodefind_bar_codeFindBarCodeFindBarCode, where the decoding is preceeded by a time consuming search for candidate regions, decode_bar_code_rectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2DecodeBarCodeRectangle2 scans the provided region directly for bar codes. The rectangular region is defined by the parameters RowRowRowRowRowrow and ColumnColumnColumnColumnColumncolumn for the center, PhiPhiPhiPhiPhiphi for the orientation and Length1Length1Length1Length1Length1length1 and Length2Length2Length2Length2Length2length2 for the half edge lengths (see gen_rectangle2gen_rectangle2GenRectangle2gen_rectangle2GenRectangle2GenRectangle2). The angle PhiPhiPhiPhiPhiphi also determines the reading direction and is defined as the angle between the reading direction of the bar code and the horizontal image axis. The angle is positive in counter clockwise direction and is given in radians as in gen_rectangle2gen_rectangle2GenRectangle2gen_rectangle2GenRectangle2GenRectangle2. Note that the angle unit deviates from the conventions in get_bar_code_resultget_bar_code_resultGetBarCodeResultget_bar_code_resultGetBarCodeResultGetBarCodeResult and set_bar_code_paramset_bar_code_paramSetBarCodeParamset_bar_code_paramSetBarCodeParamSetBarCodeParam where angles are given in degrees. PhiPhiPhiPhiPhiphi can be in the range of ['-pi'"-pi""-pi""-pi""-pi""-pi"..'+pi'"+pi""+pi""+pi""+pi""+pi"]. The reading direction is perpendicular to the bars of the bar code. Bar codes with a reading direction PhiPhiPhiPhiPhiphi + pi are also returned. Multiple regions for decoding can be given by supplying tuples for RowRowRowRowRowrow, ColumnColumnColumnColumnColumncolumn, PhiPhiPhiPhiPhiphi, Length1Length1Length1Length1Length1length1 and Length2Length2Length2Length2Length2length2.

The rectangle should cover completely the bar code and the quiet zones. Regions that are too big will be decoded, if there is no disturbing pattern within these regions and the height (Length2Length2Length2Length2Length2length2) is small enough such that scanlines can be placed sufficiently dense. Rectangles that are too short in reading direction (Length1Length1Length1Length1Length1length1) cannot be decoded.

decode_bar_code_rectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2DecodeBarCodeRectangle2 can be used if the position of the bar code is already known in advance. For example, the candidate regions found by find_bar_codefind_bar_codeFindBarCodefind_bar_codeFindBarCodeFindBarCode and get_bar_code_objectget_bar_code_objectGetBarCodeObjectget_bar_code_objectGetBarCodeObjectGetBarCodeObject could be reused with a different code type (see the following example).

Multiple bar code types can be specified for CodeTypeCodeTypeCodeTypeCodeTypeCodeTypecodeType. See section Autodiscrimination for find_bar_codefind_bar_codeFindBarCodefind_bar_codeFindBarCodeFindBarCode.

Further aspects of the actual decoding are explained with the operator find_bar_codefind_bar_codeFindBarCodefind_bar_codeFindBarCodeFindBarCode.

Attention

A bar code model BarCodeHandleBarCodeHandleBarCodeHandleBarCodeHandleBarCodeHandlebarCodeHandle cannot be shared between two or more user's threads. Different bar code models can be used independently and safely in different threads.

Parallelization

Parameters

ImageImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHImageHImageXHobject (byte / uint2)

Input image.

BarCodeHandleBarCodeHandleBarCodeHandleBarCodeHandleBarCodeHandlebarCodeHandle (input_control)  barcode HBarCode, HTupleHTupleHBarCode, HTupleHBarCodeX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Handle of the bar code model.

CodeTypeCodeTypeCodeTypeCodeTypeCodeTypecodeType (input_control)  string(-array) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Type of the searched bar code.

Default value: 'EAN-13' "EAN-13" "EAN-13" "EAN-13" "EAN-13" "EAN-13"

List of values: '2/5 Industrial'"2/5 Industrial""2/5 Industrial""2/5 Industrial""2/5 Industrial""2/5 Industrial", '2/5 Interleaved'"2/5 Interleaved""2/5 Interleaved""2/5 Interleaved""2/5 Interleaved""2/5 Interleaved", 'Codabar'"Codabar""Codabar""Codabar""Codabar""Codabar", 'Code 128'"Code 128""Code 128""Code 128""Code 128""Code 128", 'Code 39'"Code 39""Code 39""Code 39""Code 39""Code 39", 'Code 93'"Code 93""Code 93""Code 93""Code 93""Code 93", 'EAN-13 Add-On 2'"EAN-13 Add-On 2""EAN-13 Add-On 2""EAN-13 Add-On 2""EAN-13 Add-On 2""EAN-13 Add-On 2", 'EAN-13 Add-On 5'"EAN-13 Add-On 5""EAN-13 Add-On 5""EAN-13 Add-On 5""EAN-13 Add-On 5""EAN-13 Add-On 5", 'EAN-13'"EAN-13""EAN-13""EAN-13""EAN-13""EAN-13", 'EAN-8 Add-On 2'"EAN-8 Add-On 2""EAN-8 Add-On 2""EAN-8 Add-On 2""EAN-8 Add-On 2""EAN-8 Add-On 2", 'EAN-8 Add-On 5'"EAN-8 Add-On 5""EAN-8 Add-On 5""EAN-8 Add-On 5""EAN-8 Add-On 5""EAN-8 Add-On 5", 'EAN-8'"EAN-8""EAN-8""EAN-8""EAN-8""EAN-8", 'GS1 DataBar Expanded Stacked'"GS1 DataBar Expanded Stacked""GS1 DataBar Expanded Stacked""GS1 DataBar Expanded Stacked""GS1 DataBar Expanded Stacked""GS1 DataBar Expanded Stacked", 'GS1 DataBar Expanded'"GS1 DataBar Expanded""GS1 DataBar Expanded""GS1 DataBar Expanded""GS1 DataBar Expanded""GS1 DataBar Expanded", 'GS1 DataBar Limited'"GS1 DataBar Limited""GS1 DataBar Limited""GS1 DataBar Limited""GS1 DataBar Limited""GS1 DataBar Limited", 'GS1 DataBar Omnidir'"GS1 DataBar Omnidir""GS1 DataBar Omnidir""GS1 DataBar Omnidir""GS1 DataBar Omnidir""GS1 DataBar Omnidir", 'GS1 DataBar Stacked Omnidir'"GS1 DataBar Stacked Omnidir""GS1 DataBar Stacked Omnidir""GS1 DataBar Stacked Omnidir""GS1 DataBar Stacked Omnidir""GS1 DataBar Stacked Omnidir", 'GS1 DataBar Stacked'"GS1 DataBar Stacked""GS1 DataBar Stacked""GS1 DataBar Stacked""GS1 DataBar Stacked""GS1 DataBar Stacked", 'GS1 DataBar Truncated'"GS1 DataBar Truncated""GS1 DataBar Truncated""GS1 DataBar Truncated""GS1 DataBar Truncated""GS1 DataBar Truncated", 'GS1-128'"GS1-128""GS1-128""GS1-128""GS1-128""GS1-128", 'MSI'"MSI""MSI""MSI""MSI""MSI", 'PharmaCode'"PharmaCode""PharmaCode""PharmaCode""PharmaCode""PharmaCode", 'UPC-A Add-On 2'"UPC-A Add-On 2""UPC-A Add-On 2""UPC-A Add-On 2""UPC-A Add-On 2""UPC-A Add-On 2", 'UPC-A Add-On 5'"UPC-A Add-On 5""UPC-A Add-On 5""UPC-A Add-On 5""UPC-A Add-On 5""UPC-A Add-On 5", 'UPC-A'"UPC-A""UPC-A""UPC-A""UPC-A""UPC-A", 'UPC-E Add-On 2'"UPC-E Add-On 2""UPC-E Add-On 2""UPC-E Add-On 2""UPC-E Add-On 2""UPC-E Add-On 2", 'UPC-E Add-On 5'"UPC-E Add-On 5""UPC-E Add-On 5""UPC-E Add-On 5""UPC-E Add-On 5""UPC-E Add-On 5", 'UPC-E'"UPC-E""UPC-E""UPC-E""UPC-E""UPC-E", 'auto'"auto""auto""auto""auto""auto"

RowRowRowRowRowrow (input_control)  rectangle2.center.y(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Row index of the center.

Default value: 50.0

ColumnColumnColumnColumnColumncolumn (input_control)  rectangle2.center.x(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Column index of the center.

Default value: 100.0

PhiPhiPhiPhiPhiphi (input_control)  rectangle2.angle.rad(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Orientation of rectangle in radians.

Default value: 0.0

Suggested values: 0.0, 0.785398, 1.570796, 3.1415926

Length1Length1Length1Length1Length1length1 (input_control)  rectangle2.hwidth(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Half of the length of the rectangle along the reading direction of the bar code.

Default value: 200.0

Length2Length2Length2Length2Length2length2 (input_control)  rectangle2.hheight(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Half of the length of the rectangle perpendicular to the reading direction of the bar code.

Default value: 100.0

DecodedDataStringsDecodedDataStringsDecodedDataStringsDecodedDataStringsDecodedDataStringsdecodedDataStrings (output_control)  string(-array) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Data strings of all successfully decoded bar codes.

Example (HDevelop)

read_image (Image, 'barcode/ean13/ean1301.png')
create_bar_code_model ([], [], BHandle)
find_bar_code (Image, SymReg, BHandle, '2/5 Industrial', Dec)
if (|Dec| == 0)
*     A 2/5 Industrial code wasn't found. Try decoding an EAN-13 code.
    get_bar_code_object (CandReg, BHandle, 'all', 'candidate_regions')
    smallest_rectangle2 (CandReg, R, C, Phi, L1, L2)
    decode_bar_code_rectangle2 (Image, BHandle, 'EAN-13', R, C, Phi, \
                                L1, L2, Dec)
endif
clear_bar_code_model (BHandle)

Result

The operator decode_bar_code_rectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2decode_bar_code_rectangle2DecodeBarCodeRectangle2DecodeBarCodeRectangle2 returns the value 2 (H_MSG_TRUE) if the given parameters are correct. Otherwise, an exception will be raised.

Possible Predecessors

create_bar_code_modelcreate_bar_code_modelCreateBarCodeModelcreate_bar_code_modelCreateBarCodeModelCreateBarCodeModel, set_bar_code_paramset_bar_code_paramSetBarCodeParamset_bar_code_paramSetBarCodeParamSetBarCodeParam, smallest_rectangle2smallest_rectangle2SmallestRectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2

Possible Successors

get_bar_code_resultget_bar_code_resultGetBarCodeResultget_bar_code_resultGetBarCodeResultGetBarCodeResult, get_bar_code_objectget_bar_code_objectGetBarCodeObjectget_bar_code_objectGetBarCodeObjectGetBarCodeObject, clear_bar_code_modelclear_bar_code_modelClearBarCodeModelclear_bar_code_modelClearBarCodeModelClearBarCodeModel

Alternatives

find_bar_codefind_bar_codeFindBarCodefind_bar_codeFindBarCodeFindBarCode

See also

gen_rectangle2gen_rectangle2GenRectangle2gen_rectangle2GenRectangle2GenRectangle2

Module

Bar Code


ClassesClassesClassesClasses | | | | Operators