compare_ext_variation_modelT_compare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model (Operator)

Name

compare_ext_variation_modelT_compare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model — Compare an image to a variation model.

Signature

compare_ext_variation_model(Image : Region : ModelID, Mode : )

Herror T_compare_ext_variation_model(const Hobject Image, Hobject* Region, const Htuple ModelID, const Htuple Mode)

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

HRegion HVariationModel::CompareExtVariationModel(const HImage& Image, const HString& Mode) const

HRegion HVariationModel::CompareExtVariationModel(const HImage& Image, const char* Mode) const

HRegion HVariationModel::CompareExtVariationModel(const HImage& Image, const wchar_t* Mode) const   (Windows only)

HRegion HImage::CompareExtVariationModel(const HVariationModel& ModelID, const HString& Mode) const

HRegion HImage::CompareExtVariationModel(const HVariationModel& ModelID, const char* Mode) const

HRegion HImage::CompareExtVariationModel(const HVariationModel& ModelID, const wchar_t* Mode) const   (Windows only)

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

HRegion HVariationModel.CompareExtVariationModel(HImage image, string mode)

HRegion HImage.CompareExtVariationModel(HVariationModel modelID, string mode)

def compare_ext_variation_model(image: HObject, model_id: HHandle, mode: str) -> HObject

Description

compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model compares the input image ImageImageImageImageimageimage to the variation model given by ModelIDModelIDModelIDModelIDmodelIDmodel_id. compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model is an extension of compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModelcompare_variation_model that provides more modes for the image comparison. Before compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModelcompare_ext_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, for ModeModeModeModemodemode = 'absolute'"absolute""absolute""absolute""absolute""absolute" the output region RegionRegionRegionRegionregionregion contains all points that differ substantially from the model, i.e., the points that fulfill the following condition: This mode is identical to compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModelcompare_variation_model. For ModeModeModeModemodemode = 'light'"light""light""light""light""light", RegionRegionRegionRegionregionregion contains all points that are too bright: For ModeModeModeModemodemode = 'dark'"dark""dark""dark""dark""dark", RegionRegionRegionRegionregionregion contains all points that are too dark: Finally, for ModeModeModeModemodemode = 'light_dark'"light_dark""light_dark""light_dark""light_dark""light_dark" two regions are returned in RegionRegionRegionRegionregionregion. The first region contains the result of ModeModeModeModemodemode = 'light'"light""light""light""light""light", while the second region contains the result of ModeModeModeModemodemode = 'dark'"dark""dark""dark""dark""dark". The respective regions can be selected with select_objselect_objSelectObjSelectObjSelectObjselect_obj.

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.

ModeModeModeModemodemode (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Method used for comparing the variation model.

Default value: 'absolute' "absolute" "absolute" "absolute" "absolute" "absolute"

Suggested values: 'absolute'"absolute""absolute""absolute""absolute""absolute", 'light'"light""light""light""light""light", 'dark'"dark""dark""dark""dark""dark", 'light_dark'"light_dark""light_dark""light_dark""light_dark""light_dark"

Example (HDevelop)

open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, \
                   'default', -1, 'default', 'testimages.seq', 'default', \
                   -1, -1, AcqHandle)
read_region (Region, 'model.reg')
area_center (Region, Area, RowRef, ColumnRef)
read_shape_model ('model.shm', TemplateID)
read_variation_model ('model.var', ModelID)
for K := 1 to 10000 by 1
    grab_image (Image, AcqHandle)
    find_shape_model (Image, TemplateID, 0, rad(360), 0.5, 1, 0.5, \
                      'true', 4, 0.9, Row, Column, Angle, Score)
    dev_display (Image)
    if (|Score| == 1)
        vector_angle_to_rigid (Row, Column, Angle, RowRef, \
                               ColumnRef, 0, HomMat2D)
        affine_trans_image (Image, ImageTrans, HomMat2D, 'constant', \
                            'false')
        compare_ext_variation_model (ImageTrans, RegionDiff, ModelID, \
                                     'light')
        dev_display (RegionDiff)
    endif
endfor
close_framegrabber (AcqHandle)

Result

compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModelcompare_ext_variation_model returns 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

select_objselect_objSelectObjSelectObjSelectObjselect_obj, connectionconnectionConnectionConnectionConnectionconnection

Alternatives

compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModelcompare_variation_model, dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThresholddyn_threshold

See also

get_thresh_images_variation_modelget_thresh_images_variation_modelGetThreshImagesVariationModelGetThreshImagesVariationModelGetThreshImagesVariationModelget_thresh_images_variation_model

Module

Matching