GrabConsole example program with ClassicSwitch.emu

The GrabConsole example program (Common Vision Blox\Tutorial\Image Manager\CSharp\CSGrabConsole) works very good with a physical camera. We would like to use this example with an emulator.
When changing from use this example with the ClassicSwitch.emu there is an error:

I only rewrote the driverstring part in program.cs:

    Console.WriteLine("No driver given as argument. Try to load the ClassicSwitch.emu driver\n");
    driverString = Environment.ExpandEnvironmentVariables("%CVB%") + @"Tutorial\ClassicSwitch.emu";
    Console.WriteLine($"Try to load the {driverString} driver\n");

When I run the software the driver loads ok, but on image grabbing I get error code 17. The output is:

No driver given as argument. Try to load the ClassicSwitch.emu driver

Try to load the C:\Program Files\STEMMER IMAGING\Common Vision Blox\Tutorial\ClassicSwitch.emu driver

Driver loaded successfully

Acquire 10 images
Acquisition error (ErrorCode: 17)
Acquisition error (ErrorCode: 17)
Acquisition error (ErrorCode: 17)
Acquisition error (ErrorCode: 17)
Acquisition error (ErrorCode: 17)
Acquisition error (ErrorCode: 17)
Acquisition error (ErrorCode: 17)
Acquisition error (ErrorCode: 17)
Acquisition error (ErrorCode: 17)
Acquisition error (ErrorCode: 17)
Stop acquisition

Press a key to exit

What can I do to solve this?

1 Like

Hi @PBras and welcome to our forum,

The emulation files do not support the same acquisition interface as all of our modern VIN-Drivers.
The CSGrabConsole Example is designed to work with VIN-Drivers and the IGrab2 Interface.
The emulation file uses the IGrabber interface.

Side note
ErrorCode: 17 means: CVC_E_NOINTERFACE
The input image object does not support the interface required for this operation.

You can change the code using the Snap function of the IGrabber interface instead of the G2Wait function
And you need to delete the calls to G2Grab and G2Freeze. With the Grabber interface there is no need to start or stop the acquisition.

But I recommend using the GEVServer to emulate a GigE Vision device.
Then you can use the original example and you can use the GenICam.vin driver which is also used for physical cameras.
Maybe for you tests it is fine in evaluation mode getting a watermark in the image.
If you need an image without the watermark you can use a 30-day trial license of CVB.

GEVServer as local emulator
Using the GEVServer as a local emulator makes it necessary to use the Socket Driver instead of the Filter Driver on server and on the clienat side so that the stream will be visible.

Setup the Server with Socket Driver (loopback) like in the C# GigE Vision Server Example:
CSGevServerSocket

And configure the CVGevServer device from the Socket Driver in the GenICam Browser:
GCBrowserGevServerSocket

5 Likes

And to add to the possibilities: CVB .Net

If you really want only such a simple acquisition loop, the code stays the same with drivers and emus with CVB .Net. Plus you get a much nicer API.

If you need a real acquisition (e.g. integration or system test), you can use the GEVServer. And as a teaser: for the upcoming :cvb: 13.2 we will have something inbetween emus and the GEVServer.

2 Likes

Thank you both for your fast support! It works as we desired.

2 Likes