Halcon程序

1.二值化图像实现方法

difference (EmptyImage, Regions, OutRegions)
    paint_region (OutRegions, EmptyImage, ImageResult, 0, 'fill')
   
paint_region (Regions, ImageResult, ImageResult, 255, 'fill')

2.设置旋转点方法

vector_angle_to_rigid (height/2, width/2, 0, height/2, width/2, 0, HomMat2DIdentity)
draw_rectangle2 (3600, Row1, Column1, Phi, Length1, Length2)
find_line_Tool (Image, ImageResult, Row1, Column1, Phi, Length1, Length2, 5, 30, 50, 'drop', RowBegin1, ColBegin1, RowEnd1, ColEnd1)
angle:=atan((RowBegin1-RowEnd1)/(ColBegin1-ColEnd1))
hom_mat2d_rotate (HomMat2DIdentity, angle, height/2, width/2, HomMat2DRotate)
affine_trans_image (Image, ImageAffinTrans, HomMat2DRotate, 'constant', 'false')

3.移动Region

move_region (Regions, RegionMoved, -40, -170)

4.模板定位find_aniso_shape_models(Image : : ModelIDs,AngleStart,AngleExtent,ScaleRMin,ScaleRMax,ScaleCMin,ScaleCMax,MinScore,NumMatches,MaxOverlap,SubPixel,NumLevels,Greediness :Row,Column,Angle,ScaleR,ScaleC,Score,Model)

ModelIDs可使用多模板,Model为定位到的对应目标

5.参考位置转换

hom_mat2d_identity (HomMat2DIdentity)
     hom_mat2d_scale (HomMat2DIdentity, ScaleR[Match], ScaleC[Match], 0, 0, HomMat2DScale)
     hom_mat2d_rotate (HomMat2DScale, Angle[Match], 0, 0, HomMat2DRotate)
     hom_mat2d_translate (HomMat2DRotate, Row[Match], Column[Match], HomMat2DTranslate)
     affine_trans_contour_xld (ModelContours, ContoursAffinTrans, HomMat2DTranslate)   

6.Contour至Region转换gen_region_contour_xld (ContoursAffinTrans, ContourRegion, 'filled')

7.将独立的特征连接为一个整体union1 (ContourRegion, RegionUnion)

8.连接目标(连接后还是独立的)concat_obj (contour, RegionUnion, contour)

9.分解目标select_obj (contour, ObjectSelectedB, j)

10.计算两个Region的交集intersection (ObjectSelectedA, ObjectSelectedB, RegionIntersection)

11.检查数组与数值或数组相等的位置tuple_not_equal_elem (NumberShow, ObjNumberi-1, Equal)

12.自定义标定板文件,生成图像,可打印

gen_caltab (7, 7, 0.0125, 0.5, 'E:/业务/项目/昆山马培德/剪刀引导/项目程序/calibrat10mm.descr', 'E:/calibrat10mm.ps')
CameraParameters := [0.008,-6.60159,8.2856e-006,8.3e-006,1557.94,557.799,2456,2058]
CameraPose := [-0.00759192,0.00945659,0.018806,359.913,0.0236049,359.641,0]
dev_open_window (0, 0, 2456, 2058, 'white', WindowHandle)
sim_caltab (SimImage, 'caltab_30mm.descr', CameraParameters, CameraPose, 255, 255, 0, 1)
write_image (SimImage, 'tiff', 0, 'C:/Users/Administrator/Desktop/10mm.tif')

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sunny被注册

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值