prepare_variation_model ( : : ModelID, AbsThreshold, VarThreshold : )

Prepare a variation model for comparison with an image.

prepare_variation_model prepares a variation model for the image comparison with compare_variation_model. This is done by converting the ideal image and the variation image that have been trained with train_variation_model into two threshold images and storing them in the variation model. These threshold images are used in compare_variation_model to speed up the comparison of the current image to the variation model.

Two thresholds are used to compute the threshold images. The parameter 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 determines a factor relative to the variation image for the minimum difference of the current image and the ideal image. Let i(x,y) be the ideal image, v(x,y) the variation image, a=AbsThreshold, and b=VarThreshold. Then the two threshold images t{u,l} are computed as follows:

  t{u}(x,y) = i(x,y) + max{a,b*v(x,y)}
  t{l}(x,y) = i(x,y) - max{a,b*v(x,y)}
If the current image c(x,y) is compared to the variation model using compare_variation_model, the output region contains all points that differ substantially from the model, i.e., that fulfill the following condition:
  c(x,y) > t{u}(x,y) or c(x,y) < t{l}(x,y) .


Parameters

ModelID (input_control)
variation_model -> integer
ID of the variation model.

AbsThreshold (input_control)
number -> real / integer
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

VarThreshold (input_control)
number -> real / integer
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


Result

prepare_variation_model returns 2 (H_MSG_TRUE) if all parameters are correct.


Parallelization Information

prepare_variation_model is processed under mutual exclusion against itself and without parallelization.


Possible Predecessors

train_variation_model


Possible Successors

compare_variation_model


See also

create_variation_model


Module

Matching



Copyright © 1996-2008 MVTec Software GmbH