Halcon:瓶盖相关性目标识别NCC

* Image Acquisition 01: Code generated by Image Acquisition 01
open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', 'default', '[1] Webcam C170', 0, -1, AcqHandle)
grab_image_start (AcqHandle, -1)

grab_image_async (Image, AcqHandle, -1)
get_image_size (Image, Width, Height)
*转为灰度图像才能成功创建ncc模型
rgb1_to_gray (Image, grayImage)

dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
dev_display (Image)
gen_circle (Cirle, 268, 324, 87.0057)

area_center (Cirle, Area, Row, Column)
reduce_domain (grayImage, Cirle, ImageReduced)
*创建ncc模型
create_ncc_model (ImageReduced, 'auto', -0.39, 0.79, 'auto', 'use_polarity', ModelID)
dev_set_draw ('margin')
dev_display (Cirle)

while (true)
    grab_image_async (Image, AcqHandle, -1)
    rgb1_to_gray (Image, grayImage)

    * Image Acquisition 01: Do something
    *找到匹配度最高的目标
    find_ncc_model (grayImage, ModelID, -0.39, 0.79, 0.8, 1, 0.5, 'true', 0, Row, Column, Angle, Score)
    dev_display (Image)
    dev_display_ncc_matching_results (ModelID, 'green', Row, Column, Angle, 0)
endwhile
close_framegrabber (AcqHandle)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值