halcon第六讲:基于颜色空间的颜色检测

24 篇文章 715 订阅 ¥9.90 ¥99.00

基于颜色空间的颜色检测(根据HSV空间中的色度图像来识别不同颜色,因为不同颜色有不同的色度范围)

一、halcon例程1:应用范围—>颜色识别—>segment color image in HSV color space。

dev_close_window ()
dev_open_window (0, 0, 640, 480, 'black', WindowHandle)
for i := 1 to 2 by 1
    read_image (Image, 'cable' + i)
    decompose3 (Image, Red, Green, Blue)
    trans_from_rgb (Red, Green, Blue, Hue, Saturation, Intensity, 'hsv')
    *对饱和度图像进行二值化
    threshold (Saturation, HighSaturation, 100, 255)
    *在色调图像中抠图
    reduce_domain (Hue, HighSaturation, HueHighSaturation)
    threshold (HueHighSaturation, Yellow, 20, 50)
    connection (Yellow, ConnectedRegions)
    *根据形状选择,‘max_area’为选择面积最大的连通域
    select_shape_std (ConnectedRegions, SelectedRegions, 'max_area', 70)
    closing_circle (SelectedRegions, Yellow, 3.5)
    reduce_domain (Image, Yellow, ImageReduced)
    dev_display (HueHighSaturation)
    dev_display (ImageReduced)
    stop ()
e
  • 5
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

东城青年

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

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

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

打赏作者

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

抵扣说明:

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

余额充值