以前在使用算子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);
这一点被勇哥乎略了。有了这个可以在程序中自动读出设备的连接串,然后进行选择,在多相机的时候比较方便。
本文出自勇哥的网站《少有人走的路》wwww.skcircle.com,转载请注明出处!讨论可扫码加群:


