Name
prepare_direct_variation_model T_prepare_direct_variation_model PrepareDirectVariationModel PrepareDirectVariationModel — Prepare a variation model for comparison with an image.
void PrepareDirectVariationModel (const HObject& RefImage , const HObject& VarImage , const HTuple& ModelID , const HTuple& AbsThreshold , const HTuple& VarThreshold )
void HVariationModel ::PrepareDirectVariationModel (const HImage& RefImage , const HImage& VarImage , const HTuple& AbsThreshold , const HTuple& VarThreshold ) const
void HVariationModel ::PrepareDirectVariationModel (const HImage& RefImage , const HImage& VarImage , double AbsThreshold , double VarThreshold ) const
static void HOperatorSet .PrepareDirectVariationModel (HObject refImage , HObject varImage , HTuple modelID , HTuple absThreshold , HTuple varThreshold )
void HVariationModel .PrepareDirectVariationModel (HImage refImage , HImage varImage , HTuple absThreshold , HTuple varThreshold )
void HVariationModel .PrepareDirectVariationModel (HImage refImage , HImage varImage , double absThreshold , double varThreshold )
prepare_direct_variation_model prepare_direct_variation_model PrepareDirectVariationModel PrepareDirectVariationModel PrepareDirectVariationModel prepares a variation model
for the image comparison with compare_variation_model compare_variation_model CompareVariationModel CompareVariationModel CompareVariationModel or
compare_ext_variation_model compare_ext_variation_model CompareExtVariationModel CompareExtVariationModel CompareExtVariationModel . The variation model must have
been created with Mode ='direct' "direct" "direct" "direct" "direct" with
create_variation_model create_variation_model CreateVariationModel CreateVariationModel CreateVariationModel . In contrast to
prepare_variation_model prepare_variation_model PrepareVariationModel PrepareVariationModel PrepareVariationModel , the ideal image of the object and
the corresponding variation image are not computed with
train_variation_model train_variation_model TrainVariationModel TrainVariationModel TrainVariationModel , but are specified directly in
RefImage RefImage RefImage RefImage refImage and VarImage VarImage VarImage VarImage varImage . This is useful if the
variation model should be created from a single image, as described
with create_variation_model create_variation_model CreateVariationModel CreateVariationModel CreateVariationModel . The variation image should
typically be created with edge operators like sobel_amp sobel_amp SobelAmp SobelAmp SobelAmp ,
edges_image edges_image EdgesImage EdgesImage EdgesImage , or gray_range_rect gray_range_rect GrayRangeRect GrayRangeRect GrayRangeRect .
prepare_direct_variation_model prepare_direct_variation_model PrepareDirectVariationModel PrepareDirectVariationModel PrepareDirectVariationModel converts the ideal image
RefImage RefImage RefImage RefImage refImage and the variation image VarImage VarImage VarImage VarImage varImage into two
threshold images and stores them in the variation model. These
threshold images are used in compare_variation_model compare_variation_model CompareVariationModel CompareVariationModel CompareVariationModel or
compare_ext_variation_model compare_ext_variation_model CompareExtVariationModel CompareExtVariationModel CompareExtVariationModel to perform the comparison of
the current image to the variation model.
Two thresholds are used to compute the threshold images. The
parameter AbsThreshold AbsThreshold AbsThreshold AbsThreshold absThreshold 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
VarThreshold VarThreshold VarThreshold VarThreshold varThreshold determines a factor relative to the variation
image for the minimum difference of the current image and the ideal
image.
VarThreshold VarThreshold VarThreshold VarThreshold varThreshold utilizes VarImage VarImage VarImage VarImage varImage to define regions,
in which differences in gray values may occur which should not be
counted as errors.
This allows variations for specific parts of the object to inspect.
AbsThreshold AbsThreshold AbsThreshold AbsThreshold absThreshold and VarThreshold VarThreshold VarThreshold VarThreshold varThreshold 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 RefImage RefImage RefImage RefImage refImage ,
v(x,y) the variation image VarImage VarImage VarImage VarImage varImage ,
,
,
,
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_model compare_variation_model CompareVariationModel CompareVariationModel CompareVariationModel , the output
region contains all points that differ substantially from the model,
i.e., that fulfill the following condition:
In compare_ext_variation_model compare_ext_variation_model CompareExtVariationModel CompareExtVariationModel CompareExtVariationModel , 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_model get_thresh_images_variation_model GetThreshImagesVariationModel GetThreshImagesVariationModel GetThreshImagesVariationModel .
It should be noted that RefImage RefImage RefImage RefImage refImage and VarImage VarImage VarImage VarImage varImage are
not stored as the ideal and variation images in the model to save
memory in the model.
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
Processed without parallelization.
This operator modifies the state of the following input parameter:
The value of this parameter may not be shared across multiple threads without external synchronization.
Reference image of the object.
Variation image of the object.
ID of the variation model.
Absolute minimum threshold for the differences
between the image and the variation model.
Default value: 10
Suggested values: 0, 5, 10, 15, 20, 30, 40, 50
Restriction: AbsThreshold >= 0
Threshold for the differences based on the variation
of the variation model.
Default value: 2
Suggested values: 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5
Restriction: VarThreshold >= 0
read_image (Image, 'model')
sobel_amp (Image, VarImage, 'sum_abs', 3)
get_image_pointer1 (Image, Pointer, Type, Width, Height)
create_variation_model (Width, Height, Type, 'direct', ModelID)
prepare_direct_variation_model (Image, VarImage, ModelID, 20, 1)
write_variation_model (ModelID, 'model.var')
prepare_direct_variation_model prepare_direct_variation_model PrepareDirectVariationModel PrepareDirectVariationModel PrepareDirectVariationModel returns 2 (H_MSG_TRUE) if all
parameters are correct.
sobel_amp sobel_amp SobelAmp SobelAmp SobelAmp ,
edges_image edges_image EdgesImage EdgesImage EdgesImage ,
gray_range_rect gray_range_rect GrayRangeRect GrayRangeRect GrayRangeRect
compare_variation_model compare_variation_model CompareVariationModel CompareVariationModel CompareVariationModel ,
compare_ext_variation_model compare_ext_variation_model CompareExtVariationModel CompareExtVariationModel CompareExtVariationModel ,
get_thresh_images_variation_model get_thresh_images_variation_model GetThreshImagesVariationModel GetThreshImagesVariationModel GetThreshImagesVariationModel ,
write_variation_model write_variation_model WriteVariationModel WriteVariationModel WriteVariationModel
prepare_variation_model prepare_variation_model PrepareVariationModel PrepareVariationModel PrepareVariationModel
create_variation_model create_variation_model CreateVariationModel CreateVariationModel CreateVariationModel
Matching