1、首先在halcon通过相机助手生成以下代码
- * Image Acquisition 01: Code generated by Image Acquisition 01
- open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', 'default', '[0] U2B300C_1', 0, -1, AcqHandle)
- grab_image_start (AcqHandle, -1)
- while (true)
- grab_image_async (Image, AcqHandle, -1)
- * Image Acquisition 01: Do something
- endwhile
- close_framegrabber (AcqHandle)
2、导出为C#语言
- private void action()
- {
- // Local iconic variables
- HObject ho_Image=null;
- // Local control variables
- HTuple hv_AcqHandle = new HTuple();
- // Initialize local and output iconic variables
- HOperatorSet.GenEmptyObj(out ho_Image);
-
- //Image Acquisition 01: Code generated by Image Acquisition 01
- hv_A