Skip to content

read_data_code_2d_modelReadDataCode2dModelReadDataCode2dModelread_data_code_2d_modelT_read_data_code_2d_model🔗

Short description🔗

read_data_code_2d_modelReadDataCode2dModelReadDataCode2dModelread_data_code_2d_modelT_read_data_code_2d_model — Read a 2D code model from a file and create a new model.

Signature🔗

read_data_code_2d_model( filename.read FileName, out datacode_2d DataCodeHandle )void ReadDataCode2dModel( const HTuple& FileName, HTuple* DataCodeHandle )static void HOperatorSet.ReadDataCode2dModel( HTuple fileName, out HTuple dataCodeHandle )def read_data_code_2d_model( file_name: str ) -> HHandle

Herror T_read_data_code_2d_model( const Htuple FileName, Htuple* DataCodeHandle )

void HDataCode2D::HDataCode2D( const HString& FileName )

void HDataCode2D::HDataCode2D( const char* FileName )

void HDataCode2D::HDataCode2D( const wchar_t* FileName ) (Windows only)

public HDataCode2D( string fileName )

void HDataCode2D::ReadDataCode2dModel( const HString& FileName )

void HDataCode2D::ReadDataCode2dModel( const char* FileName )

void HDataCode2D::ReadDataCode2dModel( const wchar_t* FileName ) (Windows only)

void HDataCode2D.ReadDataCode2dModel( string fileName )

Description🔗

The operator read_data_code_2d_modelReadDataCode2dModel reads the 2D code model file FileNamefileNamefile_name and creates a new model that is an identical copy of the saved model. The parameter DataCodeHandledataCodeHandledata_code_handle returns the handle of the new model. The model file FileNamefileNamefile_name must be created by the operator write_data_code_2d_modelWriteDataCode2dModel. The default HALCON file extension for the 2D code model is 'dcm'.

For an explanation of the concept of the 2D code reader see the introduction of chapter Identification / Data Code.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters🔗

FileNamefileNamefile_name (input_control) filename.read → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Name of the 2D code model file.

Default: 'data_code_model.dcm'"data_code_model.dcm"
File extension: .dcm

DataCodeHandledataCodeHandledata_code_handle (output_control) datacode_2d → (handle)HTuple (HHandle)HDataCode2D, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the created 2D code model.

Example🔗

(HDevelop)

* This example demonstrates how a model that was saved in an earlier
* session can be used again by reading the model file

* Create a model by reading by reading a 2D code model file
read_data_code_2d_model ('ecc200_trained_model.dcm', DataCodeHandle)
* Read a symbol image
read_image (Image, 'datacode/ecc200/ecc200_cpu_010')
* Read the symbol in the image
find_data_code_2d (Image, SymbolXLDs, DataCodeHandle, [], [], \
                   ResultHandles, DecodedDataStrings)
* Clear the model
clear_data_code_2d_model (DataCodeHandle)

Result🔗

The operator read_data_code_2d_modelReadDataCode2dModel returns the value 2 (H_MSG_TRUE) if the named 2D code file was found and correctly read. Otherwise, an exception is raised.

Combinations with other operators🔗

Combinations

Possible successors

find_data_code_2dFindDataCode2d

Alternatives

create_data_code_2d_modelCreateDataCode2dModel

See also

write_data_code_2d_modelWriteDataCode2dModel, clear_data_code_2d_modelClearDataCode2dModel

Module🔗

Data Code