| Table of Contents / Inspection / Variation Model | Operators |
compare_ext_variation_model — Compare an image to a variation model.
compare_ext_variation_model compares the input image Image to the variation model given by ModelID. compare_ext_variation_model is an extension of compare_variation_model that provides more modes for the image comparison. Before compare_ext_variation_model can be called, the two internal threshold images of the variation model must have been created with prepare_variation_model or prepare_direct_variation_model. Let c(x,y) denote the input image Image and t{u,l} denote the two threshold images (see prepare_variation_model or prepare_direct_variation_model). Then, for Mode = 'absolute' the output region Region contains all points that differ substantially from the model, i.e., the points that fulfill the following condition:
c(x,y) > t{u}(x,y) or c(x,y) < t{l}(x,y) .
This mode is identical to compare_variation_model. For Mode = 'light', Region contains all points that are too bright:
c(x,y) > t{u}(x,y) .
For Mode = 'dark', Region contains all points that are too dark:
c(x,y) < t{l}(x,y) .
Finally, for Mode = 'light_dark' two regions are returned in Region. The first region contains the result of Mode = 'light', while the second region contains the result of Mode = 'dark'. The respective regions can be selected with select_obj.
Image of the object to be compared.
Region containing the points that differ substantially from the model.
ID of the variation model.
Method used for comparing the variation model.
Default value: 'absolute'
Suggested values: 'absolute', 'light', 'dark', 'light_dark'
open_framegrabber ('File', 1, 1, 0, 0, 0, 0, 'default', -1, \
'default', -1, 'default', 'model.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)
disp_obj (Image, WindowHandle)
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')
disp_obj (RegionDiff, WindowHandle)
endif
endfor
clear_shape_model (TemplateID)
clear_variation_model (ModelID)
close_framegrabber (AcqHandle)
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 or prepare_direct_variation_model.
prepare_variation_model, prepare_direct_variation_model
compare_variation_model, dyn_threshold
get_thresh_images_variation_model
Matching
| Table of Contents / Inspection / Variation Model | Operators |
| HALCON Reference Manual 10.0.2 | Copyright © 1996-2011 MVTec Software GmbH |