compare_variation_modelT_compare_variation_modelCompareVariationModelCompareVariationModelcompare_variation_model (Operator)

Name

compare_variation_modelT_compare_variation_modelCompareVariationModelCompareVariationModelcompare_variation_model — Compare an image to a variation model.

Signature

compare_variation_model(Image : Region : ModelID : )

Herror T_compare_variation_model(const Hobject Image, Hobject* Region, const Htuple ModelID)

void CompareVariationModel(const HObject& Image, HObject* Region, const HTuple& ModelID)

HRegion HVariationModel::CompareVariationModel(const HImage& Image) const

HRegion HImage::CompareVariationModel(const HVariationModel& ModelID) const

static void HOperatorSet.CompareVariationModel(HObject image, out HObject region, HTuple modelID)

HRegion HVariationModel.CompareVariationModel(HImage image)

HRegion HImage.CompareVariationModel(HVariationModel modelID)

def compare_variation_model(image: HObject, model_id: HHandle) -> HObject

Description

compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModelcompare_variation_model compares the input image ImageImageImageImageimageimage to the variation model given by ModelIDModelIDModelIDModelIDmodelIDmodel_id. Before compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModelcompare_variation_model can be called, the two internal threshold images of the variation model must have been created with prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModelprepare_variation_model or prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModelprepare_direct_variation_model. Let c(x,y) denote the input image ImageImageImageImageimageimage and denote the two threshold images (see prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModelprepare_variation_model or prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModelprepare_direct_variation_model). Then the output region RegionRegionRegionRegionregionregion contains all points that differ substantially from the model, i.e., the points that fulfill the following condition: If only too bright or too dark errors should be segmented the operator compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model can be used.

Execution Information

Parameters

ImageImageImageImageimageimage (input_object)  singlechannelimage(-array) objectHImageHObjectHImageHobject (byte / int2 / uint2)

Image of the object to be compared.

RegionRegionRegionRegionregionregion (output_object)  region(-array) objectHRegionHObjectHRegionHobject *

Region containing the points that differ substantially from the model.

ModelIDModelIDModelIDModelIDmodelIDmodel_id (input_control)  variation_model HVariationModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

ID of the variation model.

Example (HDevelop)

read_shape_model ('model.shm', TemplateID)
read_variation_model ('model.var', ModelID)
for K := 1 to 10 by 1
    read_image (Image, 'pen-' + K$'02')
    find_generic_shape_model (Image, TemplateID, MatchResultID, \
                              NumMatchResult)
    get_generic_shape_model_result (MatchResultID, 'all', 'hom_mat_2d', \
                                    HomMat2D)
    dev_display (Image)
    if (NumMatchResult == 1)
        affine_trans_image (Image, ImageTrans, HomMat2D, 'constant', \
                            'false')
        compare_variation_model (ImageTrans, RegionDiff, ModelID)
        dev_display (RegionDiff)
    endif
endfor

Result

compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModelcompare_variation_model returns 2 (H_MSG_TRUE) if all parameters are correct and if the internal threshold images have been generated with prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModelprepare_variation_model or prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModelprepare_direct_variation_model.

Possible Predecessors

prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModelprepare_variation_model, prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModelprepare_direct_variation_model

Possible Successors

connectionconnectionConnectionConnectionConnectionconnection

Alternatives

compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model, dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThresholddyn_threshold

See also

get_thresh_images_variation_modelget_thresh_images_variation_modelGetThreshImagesVariationModelGetThreshImagesVariationModelGetThreshImagesVariationModelget_thresh_images_variation_model

Module

Matching