read_texture_inspection_modelT_read_texture_inspection_modelReadTextureInspectionModelReadTextureInspectionModelread_texture_inspection_model (算子)

名称

read_texture_inspection_modelT_read_texture_inspection_modelReadTextureInspectionModelReadTextureInspectionModelread_texture_inspection_model — 从文件中读取纹理检查模型。

签名

read_texture_inspection_model( : : FileName : TextureInspectionModel)

Herror T_read_texture_inspection_model(const Htuple FileName, Htuple* TextureInspectionModel)

void ReadTextureInspectionModel(const HTuple& FileName, HTuple* TextureInspectionModel)

void HTextureInspectionModel::ReadTextureInspectionModel(const HString& FileName)

void HTextureInspectionModel::ReadTextureInspectionModel(const char* FileName)

void HTextureInspectionModel::ReadTextureInspectionModel(const wchar_t* FileName)   ( Windows only)

static void HOperatorSet.ReadTextureInspectionModel(HTuple fileName, out HTuple textureInspectionModel)

void HTextureInspectionModel.ReadTextureInspectionModel(string fileName)

def read_texture_inspection_model(file_name: str) -> HHandle

描述

read_texture_inspection_modelread_texture_inspection_modelReadTextureInspectionModelReadTextureInspectionModelReadTextureInspectionModelread_texture_inspection_model reads a texture inspection model that has been stored with write_texture_inspection_modelwrite_texture_inspection_modelWriteTextureInspectionModelWriteTextureInspectionModelWriteTextureInspectionModelwrite_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_modelwrite_texture_inspection_modelWriteTextureInspectionModelWriteTextureInspectionModelWriteTextureInspectionModelwrite_texture_inspection_model。In the online process the texture inspection model is read with read_texture_inspection_modelread_texture_inspection_modelReadTextureInspectionModelReadTextureInspectionModelReadTextureInspectionModelread_texture_inspection_model and subsequently used for evaluation with apply_texture_inspection_modelapply_texture_inspection_modelApplyTextureInspectionModelApplyTextureInspectionModelApplyTextureInspectionModelapply_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_modelapply_texture_inspection_modelApplyTextureInspectionModelApplyTextureInspectionModelApplyTextureInspectionModelapply_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.

有关纹理检查概念的说明,请参阅 检查 / 纹理检查 一章的引言。

执行信息

此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。

参数

FileNameFileNameFileNameFileNamefileNamefile_name (输入控制)  filename.read HTuplestrHTupleHtuple (string) (string) (HString) (char*)

File name.

File extension: .htim

TextureInspectionModelTextureInspectionModelTextureInspectionModelTextureInspectionModeltextureInspectionModeltexture_inspection_model (输出控制)  texture_inspection_model HTextureInspectionModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

纹理检查模型的句柄。

示例(HDevelop)

* 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_modelread_texture_inspection_modelReadTextureInspectionModelReadTextureInspectionModelReadTextureInspectionModelread_texture_inspection_model 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。

可能的前趋

write_texture_inspection_modelwrite_texture_inspection_modelWriteTextureInspectionModelWriteTextureInspectionModelWriteTextureInspectionModelwrite_texture_inspection_model

可能的后继

apply_texture_inspection_modelapply_texture_inspection_modelApplyTextureInspectionModelApplyTextureInspectionModelApplyTextureInspectionModelapply_texture_inspection_model

另见

create_texture_inspection_modelcreate_texture_inspection_modelCreateTextureInspectionModelCreateTextureInspectionModelCreateTextureInspectionModelcreate_texture_inspection_model, clear_texture_inspection_modelclear_texture_inspection_modelClearTextureInspectionModelClearTextureInspectionModelClearTextureInspectionModelclear_texture_inspection_model, set_texture_inspection_model_paramset_texture_inspection_model_paramSetTextureInspectionModelParamSetTextureInspectionModelParamSetTextureInspectionModelParamset_texture_inspection_model_param, get_texture_inspection_model_paramget_texture_inspection_model_paramGetTextureInspectionModelParamGetTextureInspectionModelParamGetTextureInspectionModelParamget_texture_inspection_model_param, add_texture_inspection_model_imageadd_texture_inspection_model_imageAddTextureInspectionModelImageAddTextureInspectionModelImageAddTextureInspectionModelImageadd_texture_inspection_model_image

模块

匹配