HALCON:无法连接C#中的WTH相机
我开始使用 Halcon 开发一个项目,最初使用 HDevelop 21.11 Progress 版本。
最近,我使用 MVTec.HalconDotNet
NuGet 包将代码导入到 C#,但在使用 OpenFramegrabber
连接到相机时遇到了问题,而相同的代码在 HDevelop 中运行良好。
这是给我带来问题的 C# 代码:
HOperatorSet.OpenFramegrabber("DirectShow", 1, 1, 0, 0, 0, 0, "default", 8, "rgb", -1, "false", "[1] RGB8 (3088x2076)", "[1] UI588xCP-M_4103243856", -1, 1, out HTuple AcqHandle);
// HalconDotNet.HOperatorException
完整的异常消息:
HalconDotNet.HOperatorException:'HALCON 错误 #5302:图像 获取:操作员 open_framegrabber 中的设备错误'
,这是 HDevelop 中的代码:
open_framegrabber ('DirectShow',1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', '[1] RGB8 (3088x2076)', '[1] UI588xCP-M_4103243856', -1, 1, AcqHandle)
我已经尝试使用 C# 代码上的参数,但问题仍然存在。
InfoFramegrabber 检测到设备,输出为
{["[0] 电脑摄像头", "[1] UI588xCP-M_4103243856"]}
但带有 info_boards
的 InfoFramegrabber
命令仅返回有关 device:0 的信息
(PC 相机)在 C# 中,而在 HDevelop 中它返回两个设备。
NuGet 包版本:21110.0.0
HDevelop版本:21.11 进度
I started working on a project with Halcon and initially I used HDevelop 21.11 Progress version.
Recently I imported the code to C# using MVTec.HalconDotNet
NuGet package but I'm having issues when connecting to the camera with OpenFramegrabber
, while the same code works fine in HDevelop.
This is the C# code that it's giving me issues:
HOperatorSet.OpenFramegrabber("DirectShow", 1, 1, 0, 0, 0, 0, "default", 8, "rgb", -1, "false", "[1] RGB8 (3088x2076)", "[1] UI588xCP-M_4103243856", -1, 1, out HTuple AcqHandle);
// HalconDotNet.HOperatorException
Full exception message:
HalconDotNet.HOperatorException: 'HALCON error #5302: Image
acquisition: wrong device in operator open_framegrabber'
and this is the code in HDevelop:
open_framegrabber ('DirectShow',1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', '[1] RGB8 (3088x2076)', '[1] UI588xCP-M_4103243856', -1, 1, AcqHandle)
I already tried playing around with the parameters on the C# code but the issue persist.
The device is detected by InfoFramegrabber
and the output is
{["[0] PC Camera", "[1] UI588xCP-M_4103243856"]}
but the InfoFramegrabber
command with info_boards
only return info about device:0
(the PC Camera) in C# while on HDevelop it returns both the devices.
NuGet package version: 21110.0.0
HDevelop version: 21.11 Progress
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我强烈建议使用HALCON的UEYE接口,因此可以使用完整的摄像头参数集。否则,您可以调整的设置受到直接节目接口的限制。
不幸的是,UEYE界面不再带有HALCON安装(与过去相比)。因此,您必须手动执行以下步骤安装:
因为UEYE SDK 4.96.1以下步骤是可选的,因为安装程序还将文件移至正确的目的地:
c:\ program Files \ ids \ ueye
),然后导航到\ Interfaces \ halcon \ halcon \ x64 \ x64 \ 13.0
或IN旧版本(< 4.95)\ other drivers \ halcon \ 13.0
c:
c:\ program files \ mvtec \ mvtec \ halcon -21.11-progress
)和文件夹“示例” toc:\ users \ uppur \ public \ document \ mvtec \ mvtec \ halcon-21.11-progress
在完成这些步骤后,应通过相机可通过在
open_framegrabber()
和默认参数中名称'ueye'。I would highly recommend using the uEye interface for HALCON, so the complete camera parameter set is available. Otherwise, the settings you can adjust are limited in DirectShow interface.
Unfortunately, the uEye interface doesn't come with the HALCON installation anymore (compared to the past). Therefore, you must install it manually performing the following steps:
Since uEye SDK 4.96.1 the following steps are optional, cause the installer also moves the files to the correct destination:
C:\Program Files\IDS\uEye
) and navigate to\interfaces\HALCON\x64\13.0
or in older versions (<4.95)\OtherDrivers\HALCON\13.0
C:\Program Files\MVTec\HALCON-21.11-Progress
) and the folder "examples" toC:\Users\Public\Documents\MVTec\HALCON-21.11-Progress
After completing these steps, the camera should be accessible via name 'uEye' in
open_framegrabber()
and default parameters.您可以去:助手 - &gt;图像获取 - &GT;源选项卡并单击自动检测接口?
然后转到图像采集助手中的连接选项卡单击连接,然后在图像采集助手中代码生成选项卡,并检查Open_FrameGrabber操作员的代码预览
Can you please go to: Assistants -> Image Acquisition -> Source tab and click Auto-detect Interfaces?
Then go to Connection tab in Image Acquisition Assistant click Connect and then Code Generation tab in Image Acquisition Assistant and check Code Preview for open_framegrabber operator