write_bar_code_modelT_write_bar_code_modelWriteBarCodeModelWriteBarCodeModel (Operator)

Name

write_bar_code_modelT_write_bar_code_modelWriteBarCodeModelWriteBarCodeModel — Write a bar code model to a file.

Signature

write_bar_code_model( : : BarCodeHandle, FileName : )

Herror T_write_bar_code_model(const Htuple BarCodeHandle, const Htuple FileName)

void WriteBarCodeModel(const HTuple& BarCodeHandle, const HTuple& FileName)

void HBarCode::WriteBarCodeModel(const HString& FileName) const

void HBarCode::WriteBarCodeModel(const char* FileName) const

void HBarCode::WriteBarCodeModel(const wchar_t* FileName) const   (Windows only)

static void HOperatorSet.WriteBarCodeModel(HTuple barCodeHandle, HTuple fileName)

void HBarCode.WriteBarCodeModel(string fileName)

Description

The operator write_bar_code_modelwrite_bar_code_modelWriteBarCodeModelWriteBarCodeModelWriteBarCodeModel writes the bar code model BarCodeHandleBarCodeHandleBarCodeHandleBarCodeHandlebarCodeHandle to the file FileNameFileNameFileNameFileNamefileName. The model can be read again with read_bar_code_modelread_bar_code_modelReadBarCodeModelReadBarCodeModelReadBarCodeModel. The stored data contains all generic and all specific model parameters (see set_bar_code_paramset_bar_code_paramSetBarCodeParamSetBarCodeParamSetBarCodeParam and set_bar_code_param_specificset_bar_code_param_specificSetBarCodeParamSpecificSetBarCodeParamSpecificSetBarCodeParamSpecific, respectively). If the model is in training modus (see set_bar_code_paramset_bar_code_paramSetBarCodeParamSetBarCodeParamSetBarCodeParam with parameter 'train'"train""train""train""train"), the current training state is stored as well. After restoring the model, the training can be proceeded.

Besides the training state no other results of find_bar_codefind_bar_codeFindBarCodeFindBarCodeFindBarCode are stored in the file.

The default HALCON file extension for bar code model is 'bcm'.

Execution Information

Parameters

BarCodeHandleBarCodeHandleBarCodeHandleBarCodeHandlebarCodeHandle (input_control)  barcode HBarCode, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the bar code model.

FileNameFileNameFileNameFileNamefileName (input_control)  filename.write HTupleHTupleHtuple (string) (string) (HString) (char*)

Name of the bar code model file.

Default value: 'bar_code_model.bcm' "bar_code_model.bcm" "bar_code_model.bcm" "bar_code_model.bcm" "bar_code_model.bcm"

File extension: .bcm

Example (HDevelop)

*
* Create the bar code model in the training mode
create_bar_code_model ('train', 'all', BarCodeHandle)
*
* Set all additional, non-trained parameters in advance:
* Here, we specify that the training images have check characters
set_bar_code_param (BarCodeHandle, 'check_char', 'present')
*
* Train the model with several images
for I := 1 to 7 by 1
    FileName := 'barcode/25interleaved/25interleaved' + I$'.02'
    read_image (Image, FileName)
    *
    * Apply the training
    find_bar_code (Image, SymbolRegion, BarCodeHandle, '2/5 Interleaved', \
                   DecodedDataStrings)
endfor
*
* The training may be interrupted and the intermediate state
* of the model can be stored in a file
write_bar_code_model (BarCodeHandle, 'bar_code_model.bcm')
*
* RESTORE TRAINING:
* Later, when, e.g., new images are available, the training
* may be restored
read_bar_code_model ('bar_code_model.bcm', BarCodeHandle)
FileName := 'barcode/25interleaved/25interleaved08'
read_image (Image, FileName)
*
* Apply the training to the new image
find_bar_code (Image, SymbolRegion, BarCodeHandle, '2/5 Interleaved', \
               DecodedDataStrings)
*
* Finally, the training can be completed
set_bar_code_param (BarCodeHandle, 'train', '~all')
*
* The trained model can be stored for ONLINE use
write_bar_code_model (BarCodeHandle, 'trained_bar_code_model.bcm')
*
* ONLINE USE:
read_bar_code_model ('trained_bar_code_model.bcm', BarCodeHandle)
* ...

Result

The operator write_bar_code_modelwrite_bar_code_modelWriteBarCodeModelWriteBarCodeModelWriteBarCodeModel returns the value 2 (H_MSG_TRUE) if the passed handle is valid and if the model can be written into the named file. Otherwise, an exception is raised.

Possible Predecessors

create_bar_code_modelcreate_bar_code_modelCreateBarCodeModelCreateBarCodeModelCreateBarCodeModel, set_bar_code_paramset_bar_code_paramSetBarCodeParamSetBarCodeParamSetBarCodeParam

See also

create_bar_code_modelcreate_bar_code_modelCreateBarCodeModelCreateBarCodeModelCreateBarCodeModel, set_bar_code_paramset_bar_code_paramSetBarCodeParamSetBarCodeParamSetBarCodeParam, find_bar_codefind_bar_codeFindBarCodeFindBarCodeFindBarCode

Module

Bar Code