gen_rectangle2 (ModelRegion, 127.104, 603.538, -0.0, 121.395,22.8544)
* Matching 02: reduce the model template
reduce_domain (Image, ModelRegion, TemplateImage)
* Matching 02: create the shape model
create_shape_model (TemplateImage, 4, rad(0), rad(360), rad(1), 'pregeneration', 'use_polarity', 'auto', 'auto', ModelId)
* Matching 02: get the model contour for transforming it later into the image
get_shape_model_contours (ModelContours, ModelId, 1)
* Matching 02: END of generated code for model initialization
* Matching 02: BEGIN of generated code for model application
* Matching 02: the following operations are usually moved into
* Matching 02: that loop where the aquired images are processed
* Matching 02: Find the model
read_image (Image1, 'D:/1/1-7.bmp')
read_shape_model ('D:/MachineVisionSoftWare/MachineVisionSoftWare/bin/Debug/shmFiles/CreateShapeModel20230617082908.shm', ModelID)
get_shape_model_params (ModelID, NumLevels, AngleStart, AngleExtent, AngleStep, ScaleMin, ScaleMax, ScaleStep, Metric, MinContrast)
find_shape_model (Image1, ModelID, rad(0), rad(360), 0.5, 0, 0.5, 'least_squares', 4, 0.9, ModelRow, ModelColumn, ModelAngle, ModelScore)
* Matching 02: transform the model contours into the detected positions
for MatchingObjIdx := 0 to |ModelScore| - 1 by 1
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_translate (HomMat2DIdentity, ModelRow[MatchingObjIdx], ModelColumn[MatchingObjIdx], HomMat2DTranslate)
hom_mat2d_rotate (HomMat2DTranslate, ModelAngle[MatchingObjIdx], ModelRow[MatchingObjIdx], ModelColumn[MatchingObjIdx], HomMat2DRotate)
*hom_mat2d_rotate (HomMat, ModelAngle[MatchingObjIdx], ModelRow[MatchingObjIdx], ModelColumn[MatchingObjIdx], rotateHomMat)
*hom_mat2d_translate (rotateHomMat, ModelRow[MatchingObjIdx], ModelColumn[MatchingObjIdx], translateHomMat)
* affine_trans_contour_xld (ModelContours, TransContours, HomMat2DRotate)
* dev_display (ModelContours)
endfor
dev_display(Image1)
* dev_display (TransContours)
* Matching 02: Clear model when done
clear_shape_model (ModelID)
* Matching 02: END of generated code for model application
CreateShapeModel
最新推荐文章于 2024-02-29 11:09:53 发布