HALCON:无法连接C#中的WTH相机

发布于 2025-01-20 12:13:42 字数 1140 浏览 4 评论 0原文

我开始使用 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_boardsInfoFramegrabber 命令仅返回有关 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

像你 2025-01-27 12:13:42

我强烈建议使用HALCON的UEYE接口,因此可以使用完整的摄像头参数集。否则,您可以调整的设置受到直接节目接口的限制。

不幸的是,UEYE界面不再带有HALCON安装(与过去相比)。因此,您必须手动执行以下步骤安装:

  1. 安装UEYE SDK(推荐的最新版本4.96.1)具有组件“ Interfaces/halcon”,

因为UEYE SDK 4.96.1以下步骤是可选的,因为安装程序还将文件移至正确的目的地:

  1. 转到UEYE安装路径(默认情况下:c:\ program Files \ ids \ ueye),然后导航到\ Interfaces \ halcon \ halcon \ x64 \ x64 \ 13.0或IN旧版本(< 4.95)\ other drivers \ halcon \ 13.0
  2. 将文件夹“ bin”和“ doc”复制到%halconroot%(默认情况下:c:c:\ program files \ mvtec \ mvtec \ halcon -21.11-progress)和文件夹“示例” to c:\ 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:

  1. Install uEye SDK (recommended newest version 4.96.1) with component "Interfaces/HALCON"

Since uEye SDK 4.96.1 the following steps are optional, cause the installer also moves the files to the correct destination:

  1. Go to uEye installation path (by default: C:\Program Files\IDS\uEye) and navigate to \interfaces\HALCON\x64\13.0 or in older versions (<4.95)\OtherDrivers\HALCON\13.0
  2. Copy the folders "bin" and "doc" to %HALCONROOT% (by default: C:\Program Files\MVTec\HALCON-21.11-Progress) and the folder "examples" to C:\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.

一枫情书 2025-01-27 12:13:42

您可以去:助手 - &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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文