halcon例程注解ball_seq.hdev检测球形焊锡

ball_seq.hdev检测球形焊锡

* ball_seq.hdev: Inspection of Ball Bonding,检测球形焊锡
* 
dev_update_off ()
ImageNames := 'die/' + ['die_02','die_03','die_04','die_07']
dev_set_colored (12)
read_image (Bond, ImageNames[0])
get_image_size (Bond, Width, Height)
dev_close_window ()
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_set_draw ('margin')
dev_set_line_width (3)
NumImages := |ImageNames|
for I := 0 to NumImages - 1 by 1
    * 初始化
    gen_empty_region (Forbidden)
    read_image (Bond, ImageNames[I])
    dev_display (Bond)
    * 1、粗定位,使用白的区域和ROI在一起的特性
    * 使用[最大灰度-80,255]来定位
    min_max_gray (Bond, Bond, 0, Min, Max, Range)
    threshold (Bond, Bright, Max - 80, 255)
    shape_trans (Bright, Die, 'rectangle2')
    dev_display (Die)
    reduce_domain (Bond, Die, DieGrey)
    min_max_gray (Die, Bond, 0, Min, Max, Range)
    * 2、二次定位,使用[0,Min+ 30]来定位暗ROI
    threshold (DieGrey, Wires, 0, Min + 30)
    fill_up_shape (Wires, WiresFilled, 'area', 1, 100)
    opening_circle (WiresFilled, Balls, 9.5)
    connection (Balls, SingleBalls)
    select_shape_std (SingleBalls, Rect, 'rectangle1', 90)
    difference (SingleBalls, Rect, IntermediateBalls)
    * 包含ROI区域附近和ROI灰度差不多的区域,以及进行填充区域之间的空白
    * 比单纯膨胀获得的干扰少
    expand_gray (IntermediateBalls, Bond, Forbidden, RegionExpand, 4, 'image', 6)
    opening_circle (RegionExpand, RoundBalls, 15.5)
    sort_region (RoundBalls, FinalBalls, 'first_point', 'true', 'column')
    smallest_circle (FinalBalls, Row, Column, Radius)
    NumBalls := |Radius|
    Diameter := 2 * Radius
    meanDiameter := sum(Diameter) / NumBalls
    mimDiameter := min(Diameter)
    dev_clear_window ()
    dev_display (Bond)
    dev_display (RoundBalls)
    if (I != NumImages)
        disp_continue_message (WindowHandle, 'black', 'true')
    endif
*     stop ()
endfor

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

小菠萝0908

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

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

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

打赏作者

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

抵扣说明:

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

余额充值