prepare_variation_modelT_prepare_variation_modelPrepareVariationModelPrepareVariationModelprepare_variation_model (算子)

名称

prepare_variation_modelT_prepare_variation_modelPrepareVariationModelPrepareVariationModelprepare_variation_model — 准备一个变体模型,以便与图像进行比较。

签名

prepare_variation_model( : : ModelID, AbsThreshold, VarThreshold : )

Herror T_prepare_variation_model(const Htuple ModelID, const Htuple AbsThreshold, const Htuple VarThreshold)

void PrepareVariationModel(const HTuple& ModelID, const HTuple& AbsThreshold, const HTuple& VarThreshold)

void HVariationModel::PrepareVariationModel(const HTuple& AbsThreshold, const HTuple& VarThreshold) const

void HVariationModel::PrepareVariationModel(double AbsThreshold, double VarThreshold) const

static void HOperatorSet.PrepareVariationModel(HTuple modelID, HTuple absThreshold, HTuple varThreshold)

void HVariationModel.PrepareVariationModel(HTuple absThreshold, HTuple varThreshold)

void HVariationModel.PrepareVariationModel(double absThreshold, double varThreshold)

def prepare_variation_model(model_id: HHandle, abs_threshold: MaybeSequence[Union[float, int]], var_threshold: MaybeSequence[Union[float, int]]) -> None

描述

prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModelprepare_variation_model prepares a variation model for the image comparison with compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModelcompare_variation_model or compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model。This is done by converting the ideal image and the variation image that have been trained with train_variation_modeltrain_variation_modelTrainVariationModelTrainVariationModelTrainVariationModeltrain_variation_model into two threshold images and storing them in the variation model. These threshold images are used in compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModelcompare_variation_model or compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model to speed up the comparison of the current image to the variation model.

Two thresholds are used to compute the threshold images. The parameter AbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThresholdabs_threshold determines the minimum amount of gray levels by which the image of the current object must differ from the image of the ideal object. The parameter VarThresholdVarThresholdVarThresholdVarThresholdvarThresholdvar_threshold determines a factor relative to the variation image for the minimum difference of the current image and the ideal image. AbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThresholdabs_threshold and VarThresholdVarThresholdVarThresholdVarThresholdvarThresholdvar_threshold each can contain one or two values. If two values are specified, different thresholds can be determined for too bright and too dark pixels. In this mode, the first value refers to too bright pixels, while the second value refers to too dark pixels. If one value is specified, this value refers to both the too bright and too dark pixels. Let i(x,y) be the ideal image, v(x,y) the variation image, , , , and (or , , , and , respectively). Then the two threshold images are computed as follows: If the current image c(x,y) is compared to the variation model using compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModelcompare_variation_model, the output region contains all points that differ substantially from the model, i.e., that fulfill the following condition: In compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model, extended comparison modes are available, which return only too bright errors, only too dark errors, or bright and dark errors as separate regions.

After the threshold images have been created they can be read out with get_thresh_images_variation_modelget_thresh_images_variation_modelGetThreshImagesVariationModelGetThreshImagesVariationModelGetThreshImagesVariationModelget_thresh_images_variation_model。Furthermore, the training data can be deleted with clear_train_data_variation_modelclear_train_data_variation_modelClearTrainDataVariationModelClearTrainDataVariationModelClearTrainDataVariationModelclear_train_data_variation_model to save memory.

执行信息

此算子修改后续输入参数的状态:

在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。

参数

ModelIDModelIDModelIDModelIDmodelIDmodel_id (输入控制,状态被修改)  variation_model HVariationModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

ID of the variation model.

AbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThresholdabs_threshold (输入控制)  number(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Absolute minimum threshold for the differences between the image and the variation model.

默认值: 10

建议值: 0, 5, 10, 15, 20, 30, 40, 50

限制: AbsThreshold >= 0

VarThresholdVarThresholdVarThresholdVarThresholdvarThresholdvar_threshold (输入控制)  number(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Threshold for the differences based on the variation of the variation model.

默认值: 2

建议值: 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5

限制: VarThreshold >= 0

结果

prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModelprepare_variation_model 在所有参数正确时返回 2 ( H_MSG_TRUE )。

可能的前趋

train_variation_modeltrain_variation_modelTrainVariationModelTrainVariationModelTrainVariationModeltrain_variation_model

可能的后继

compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModelcompare_variation_model, compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model, get_thresh_images_variation_modelget_thresh_images_variation_modelGetThreshImagesVariationModelGetThreshImagesVariationModelGetThreshImagesVariationModelget_thresh_images_variation_model, clear_train_data_variation_modelclear_train_data_variation_modelClearTrainDataVariationModelClearTrainDataVariationModelClearTrainDataVariationModelclear_train_data_variation_model, write_variation_modelwrite_variation_modelWriteVariationModelWriteVariationModelWriteVariationModelwrite_variation_model

替代

prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModelprepare_direct_variation_model

另见

create_variation_modelcreate_variation_modelCreateVariationModelCreateVariationModelCreateVariationModelcreate_variation_model

模块

匹配