HALCON示例程序resistor.hdev通过不同焦距图像提取深度信息

小哥哥小姐姐觉得有用点个赞呗!
在这里插入图片描述

HALCON示例程序resistor.hdev通过不同焦距图像提取深度信息

示例程序源码(加注释)

  • 关于显示类函数解释
    Names := []
    dev_close_window ()
    for i := 1 to 10 by 1
    Names := [Names,‘dff/focus_’ + (i$’.2’)]
    endfor
    read_image (Image, Names)
  • 将多通道图像组成一个多通道图像
    channels_to_image (Image, Image)
    get_image_size (Image, Width, Height)
    dev_open_window (0, 0, Width, Height, ‘black’, WindowHandle)
    for i := 1 to 10 by 1
    访问多通道图像的指定通道
    access_channel (Image, Image1, i)
    endfor
  • depth_from_focus - 使用多个焦点水平提取深度。
  • depth_from_focus(多通道图像:深度信息,深度图像:方式,提取清晰像素方式:)
    depth_from_focus (Image, Depth, Confidence, ‘highpass’, ‘next_maximum’)
  • 均值滤波
    mean_image (Depth, DepthHighConf, 11, 11)
  • 将像素值扩大到0-255
    scale_image_max (DepthHighConf, ImageScaleMax)
  • 均值滤波
    mean_image (ImageScaleMax, DepthMean, 51, 51)
  • 二值化
    threshold (DepthMean, Resistor, 158, 255)
  • 分割连通域
    connection (Resistor, ConnectedRes)
  • 选取最大面积区域
    select_shape_std (ConnectedRes, FinalRes, ‘max_area’, 0)
  • 二值化
    threshold (DepthMean, Solder, 125, 158)
  • 分割连通域
    connection (Solder, ConnectedSol)
  • 筛选最大面积区域
    select_shape_std (ConnectedSol, SelectedSol, ‘max_area’, 0)
  • 填充孔洞
    fill_up (SelectedSol, FinalSol)
    dev_set_line_width (3)
    dev_set_draw (‘margin’)
    dev_display (Image)
    dev_set_color (‘red’)
    dev_display (FinalSol)
    dev_set_color (‘blue’)
    dev_display (FinalRes)

处理思路

这个例子是主要讲解了通过不同焦距图像提取深度信息的应用。

后记

大家有什么问题可以向我提问哈,我看到了第一时间回复,希望在学习的路上多多结交良师益友。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值