read_texture_inspection_model — 从文件中读取纹理检查模型。
read_texture_inspection_model( : : FileName : TextureInspectionModel)
read_texture_inspection_model reads a texture inspection model that
has been stored with write_texture_inspection_model。Since the
training of a texture inspection model can consume a relatively long time,
the texture inspection model is typically trained in an offline process and
written to a file with write_texture_inspection_model。In the online
process the texture inspection model is read with
read_texture_inspection_model and subsequently used for evaluation
with apply_texture_inspection_model。The default HALCON file extension for the texture inspection model is
'htim'.
After reading a trained texture inspection model, it is possible to
classify test images using apply_texture_inspection_model。However,
retraining this model can only be done, if the read model has images.
Furthermore, modifying parameters of the model leads to an entire retraining.
有关纹理检查概念的说明,请参阅 检查 / 纹理检查 一章的引言。
此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。
FileName (输入控制) filename.read → (string)
File name.
File extension:
.htim
TextureInspectionModel (输出控制) texture_inspection_model → (handle)
纹理检查模型的句柄。
* Create texture inspection model
create_texture_inspection_model ('basic', TextureInspectionModel)
* Make this short example fast:
set_texture_inspection_model_param (TextureInspectionModel, \
'gmm_em_max_iter', 1)
* Read and add training images
read_image (TrainImage, 'carpet/carpet_01')
add_texture_inspection_model_image (TrainImage, TextureInspectionModel, \
Indices)
* Train the model
train_texture_inspection_model (TextureInspectionModel)
* Write out texture inspection model
write_texture_inspection_model (TextureInspectionModel, \
'ExampleModel.htim')
* Read in Model
read_texture_inspection_model ('ExampleModel.htim', \
TextureInspectionModelRead)
* Read and apply a test image
read_image (TestImage, 'carpet/carpet_02')
apply_texture_inspection_model (TestImage, DefectCandidates, \
TextureInspectionModelRead, \
TextureInspectionResultID)
如果参数有效,算子
read_texture_inspection_model 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。
write_texture_inspection_model
apply_texture_inspection_model
create_texture_inspection_model,
clear_texture_inspection_model,
set_texture_inspection_model_param,
get_texture_inspection_model_param,
add_texture_inspection_model_image
匹配