halcon模板匹配测试流程

12 篇文章 4 订阅

*1、创建模板(获取要做模板区域的图像)
   *create_shape_model (ImageReduced, 4, 0, rad(360), rad(1), 'none', 'use_polarity', 30, 10, ModelID)
*2、获取形状模型---第二步(为了显示找的的模板)
   *get_shape_model_contours (ShapeModel, ModelID, 1)
*3、查找模板
   *find_shape_model (ImageCheck, ModelID, 0, rad(360), 0.7, 1, 0.5, 'least_squares', 4, 0.7, RowCheck, ColumnCheck, AngleCheck, Score)
*4、仿射变换,确定变换矩阵
    *1)第一种方法,获取变换矩阵HomMat2D;
       *vector_angle_to_rigid (0, 0, 0, RowCheck, ColumnCheck, AngleCheck, HomMat2D)
       *affine_trans_contour_xld (ShapeModel, ShapeModelTrans, HomMat2D)
    *2)第二种方法,获取变换矩阵HomMat2DRotate
       *hom_mat2d_identity (HomMat2DIdentity)
       *hom_mat2d_translate (HomMat2DIdentity, RowCheck, ColumnCheck, HomMat2DTranslate)
       *hom_mat2d_rotate (HomMat2DTranslate, AngleCheck, RowCheck, ColumnCheck, HomMat2DRotate)
       *affine_trans_contour_xld (ShapeModel, ShapeModelTrans, HomMat2DRotate)
*5、通过确定的变换矩阵执行其他检测内容;如测量:首先要对要进行测量区域的中心点进行变换;
   *affine_trans_pixel (HomMat2DRotate, Rect1Row, Rect1Col, Rect1RowCheck, Rect1ColCheck)

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值