CreateShapeModel

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值