write_bar_code_model
— Write a bar code model to a file.
write_bar_code_model( : : BarCodeHandle, FileName : )
The operator write_bar_code_model
writes the bar code model
BarCodeHandle
to the file FileName
. The model
can be read again with read_bar_code_model
.
The stored data contains all generic and all specific model parameters
(see set_bar_code_param
and set_bar_code_param_specific
,
respectively). If the model is in training mode (see
set_bar_code_param
with parameter '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_code
are
stored in the file.
The default HALCON file extension for bar code model is 'bcm'.
BarCodeHandle
(input_control) barcode →
(handle)
Handle of the bar code model.
FileName
(input_control) filename.write →
(string)
Name of the bar code model file.
Default value: 'bar_code_model.bcm'
File extension: .bcm
* * 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) * ...
The operator write_bar_code_model
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.
create_bar_code_model
,
set_bar_code_param
create_bar_code_model
,
set_bar_code_param
,
find_bar_code
Bar Code