'Halcon: Cannot connect wth camera in C#

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



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1