compare_variation_modelT_compare_variation_modelCompareVariationModelCompareVariationModel (Operator)
Name
compare_variation_modelT_compare_variation_modelCompareVariationModelCompareVariationModel
— Compare an image to a variation model.
Signature
Herror T_compare_variation_model(const Hobject Image, Hobject* Region, const Htuple ModelID)
Description
compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModel
compares the input image
ImageImageImageImageimage
to the variation model given by ModelIDModelIDModelIDModelIDmodelID
.
Before compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModel
can be called, the two
internal threshold images of the variation model must have been
created with prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModel
or
prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModel
. Let c(x,y)
denote the input image ImageImageImageImageimage
and
denote the two threshold images (see prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModel
or prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModel
). Then the output region
RegionRegionRegionRegionregion
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_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModel
can be used.
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
- Automatically parallelized on domain level.
Parameters
ImageImageImageImageimage
(input_object) singlechannelimage(-array) →
objectHImageHImageHobject (byte / int2 / uint2)
Image of the object to be compared.
RegionRegionRegionRegionregion
(output_object) region(-array) →
objectHRegionHRegionHobject *
Region containing the points that differ
substantially from the model.
ModelIDModelIDModelIDModelIDmodelID
(input_control) variation_model →
HVariationModel, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
ID of the variation model.
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_variation_model (ImageTrans, RegionDiff, ModelID)
dev_display (RegionDiff)
endif
endfor
close_framegrabber (AcqHandle)
Result
compare_variation_modelcompare_variation_modelCompareVariationModelCompareVariationModelCompareVariationModel
returns 2 (H_MSG_TRUE) if all parameters are
correct and if the internal threshold images have been generated
with prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModel
or
prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModel
.
Possible Predecessors
prepare_variation_modelprepare_variation_modelPrepareVariationModelPrepareVariationModelPrepareVariationModel
,
prepare_direct_variation_modelprepare_direct_variation_modelPrepareDirectVariationModelPrepareDirectVariationModelPrepareDirectVariationModel
Possible Successors
connectionconnectionConnectionConnectionConnection
Alternatives
compare_ext_variation_modelcompare_ext_variation_modelCompareExtVariationModelCompareExtVariationModelCompareExtVariationModel
,
dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThreshold
See also
get_thresh_images_variation_modelget_thresh_images_variation_modelGetThreshImagesVariationModelGetThreshImagesVariationModelGetThreshImagesVariationModel
Module
Matching