compare_ext_variation_model T_compare_ext_variation_model CompareExtVariationModel CompareExtVariationModel compare_ext_variation_model (Operator)
Name
compare_ext_variation_model T_compare_ext_variation_model CompareExtVariationModel CompareExtVariationModel compare_ext_variation_model
— Compare an image to a variation model.
Signature
Herror T_compare_ext_variation_model (const Hobject Image , Hobject* Region , const Htuple ModelID , const Htuple Mode )
def compare_ext_variation_model (image : HObject, model_id : HHandle, mode : str) -> HObject
Description
compare_ext_variation_model compare_ext_variation_model CompareExtVariationModel CompareExtVariationModel compare_ext_variation_model
compares the input image
Image Image Image image image
to the variation model given by ModelID ModelID ModelID modelID model_id
.
compare_ext_variation_model compare_ext_variation_model CompareExtVariationModel CompareExtVariationModel compare_ext_variation_model
is an extension of
compare_variation_model compare_variation_model CompareVariationModel CompareVariationModel compare_variation_model
that provides more modes for the
image comparison. Before compare_ext_variation_model compare_ext_variation_model CompareExtVariationModel CompareExtVariationModel compare_ext_variation_model
can be
called, the two internal threshold images of the variation model
must have been created with prepare_variation_model prepare_variation_model PrepareVariationModel PrepareVariationModel prepare_variation_model
or
prepare_direct_variation_model prepare_direct_variation_model PrepareDirectVariationModel PrepareDirectVariationModel prepare_direct_variation_model
. Let c(x,y)
denote the input image Image Image Image image image
and
denote the two threshold images (see prepare_variation_model prepare_variation_model PrepareVariationModel PrepareVariationModel prepare_variation_model
or prepare_direct_variation_model prepare_direct_variation_model PrepareDirectVariationModel PrepareDirectVariationModel prepare_direct_variation_model
). Then, for Mode Mode Mode mode mode
= 'absolute' "absolute" "absolute" "absolute" "absolute" the output region Region Region Region region region
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_model compare_variation_model CompareVariationModel CompareVariationModel compare_variation_model
. For
Mode Mode Mode mode mode
= 'light' "light" "light" "light" "light" , Region Region Region region region
contains all
points that are too bright:
For Mode Mode Mode mode mode
= 'dark' "dark" "dark" "dark" "dark" , Region Region Region region region
contains all
points that are too dark:
Finally, for Mode Mode Mode mode mode
= 'light_dark' "light_dark" "light_dark" "light_dark" "light_dark" two regions are
returned in Region Region Region region region
. The first region contains the result
of Mode Mode Mode mode mode
= 'light' "light" "light" "light" "light" , while the second region
contains the result of Mode Mode Mode mode mode
= 'dark' "dark" "dark" "dark" "dark" . The
respective regions can be selected with select_obj select_obj SelectObj SelectObj select_obj
.
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
Image Image Image image image
(input_object) singlechannelimage(-array) →
object HImage HObject HObject Hobject (byte / int2 / uint2)
Image of the object to be compared.
Region Region Region region region
(output_object) region(-array) →
object HRegion HObject HObject Hobject *
Region containing the points that differ
substantially from the model.
ModelID ModelID ModelID modelID model_id
(input_control) variation_model →
HVariationModel , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
ID of the variation model.
Mode Mode Mode mode mode
(input_control) string →
HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
Method used for comparing the variation model.
Default:
'absolute'
"absolute"
"absolute"
"absolute"
"absolute"
Suggested values:
'absolute' "absolute" "absolute" "absolute" "absolute" , 'light' "light" "light" "light" "light" , 'dark' "dark" "dark" "dark" "dark" , 'light_dark' "light_dark" "light_dark" "light_dark" "light_dark"
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_ext_variation_model (ImageTrans, RegionDiff, ModelID, \
'absolute')
dev_display (RegionDiff)
endif
endfor
Result
compare_ext_variation_model compare_ext_variation_model CompareExtVariationModel CompareExtVariationModel compare_ext_variation_model
returns 2 (
H_MSG_TRUE )
if all parameters
are correct and if the internal threshold images have been generated
with prepare_variation_model prepare_variation_model PrepareVariationModel PrepareVariationModel prepare_variation_model
or
prepare_direct_variation_model prepare_direct_variation_model PrepareDirectVariationModel PrepareDirectVariationModel prepare_direct_variation_model
.
Possible Predecessors
prepare_variation_model prepare_variation_model PrepareVariationModel PrepareVariationModel prepare_variation_model
,
prepare_direct_variation_model prepare_direct_variation_model PrepareDirectVariationModel PrepareDirectVariationModel prepare_direct_variation_model
Possible Successors
select_obj select_obj SelectObj SelectObj select_obj
,
connection connection Connection Connection connection
Alternatives
compare_variation_model compare_variation_model CompareVariationModel CompareVariationModel compare_variation_model
,
dyn_threshold dyn_threshold DynThreshold DynThreshold dyn_threshold
See also
get_thresh_images_variation_model get_thresh_images_variation_model GetThreshImagesVariationModel GetThreshImagesVariationModel get_thresh_images_variation_model
Module
Matching