halcon打开USB摄像头
本人用的大街上卖的那种傻瓜式USB摄像头
基本步骤
![](https://images.cnblogs.com/cnblogs_com/xiaomaLV2/201206/201206011350365866.png)
dev_update_window('off')
set_system ('do_low_error', 'true')
close_all_framegrabbers()
AcqName :='DirectShow'
open_framegrabber (AcqName, 1, 1, 0, 0, 0, 0, 'default', -1, 'rgb',\
-1, 'false', 'default', 'default', -1, -1, AcqHandle)
grab_image(Image,AcqHandle)
get_image_size(Image,Width,Height)
dev_close_window()
dev_open_window(0,0,Width,Height,'black',WindowHandle)
Button :=0
*Button 不等于1
while(Button # 1)
grab_image(Image,AcqHandle)
dev_display(Image)
wait_seconds(0.03)
*按鼠标左键 button 等于 1
dev_set_window (WindowHandle)
*If Mode is set to '~give_error', the error will be
*ignored and the program continues with the next operator
dev_set_check ('~give_error')
get_mposition(WindowHandle,Row,Column,Button)
dev_set_check ('give_error')
endwhile