×

halcon 机器学习

算子OpenFramegrabbe获取halcon的相机设备连接字符串

勇哥,很想停止 勇哥,很想停止 发表于2019-07-25 11:08:17 浏览7967 评论2

2人参与发表评论


以前在使用算子OpenFramegrabbe连接相机时,一般是这样的:

open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', 'default', 'default', 0, -1, AcqHandle)
grab_image_start (AcqHandle, -1)

    grab_image_async (Image, AcqHandle, -1)
    * Do something

close_framegrabber (AcqHandle)

但是其实第4个参数,可以传出相机连接字符串,并不一定总是设置为'default',如下代码所示:

HOperatorSet.OpenFramegrabber(new HTuple("DirectShow"),
      new HTuple(0),
      new HTuple(0),
      new HTuple(0),
      new HTuple(0),
      new HTuple(0),
      new HTuple(0),
      new HTuple("progressive"),
      new HTuple(-1),
      new HTuple("default"),
      new HTuple(-1),
      new HTuple("false"),
      new HTuple("default"),
      Work.Instance.cameraStr,
      new HTuple(0),
      new HTuple(-1),
 out handle);


这一点被勇哥乎略了。有了这个可以在程序中自动读出设备的连接串,然后进行选择,在多相机的时候比较方便。


群贤毕至

访客
访客 访客2020-10-21 14:59:03 · 回复 以下算子用于读出设备列表
info_framegrabber ('DirectShow', 'device', Information, ValueList)
很想停止 很想停止2020-10-23 21:37:49 · 回复 感谢追加知识