Common Vision Blox 15.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Friends Modules Pages
ImageManager/Cvb.Net/DeviceConfiguration

This example program is located in your CVB installation under %CVB%Tutorial/ImageManager/Cvb.Net/DeviceConfiguration.

Program.cs:

// Example that demonstrates buffer updates when modifying a parameter that affects the buffer size.

using System;
namespace DeviceConfiguration
{
class DeviceConfiguration
{
static void Main(string[] args)
{
using (var devices = DeviceFactory.Discover(DiscoverFlags.IgnoreVins))
{
using (var device = DeviceFactory.Open(devices[0], AcquisitionStack.GenTL))
{
var stream = ((GenICamDevice)device).GetStream<ImageStream>(0);
// do some acquisition
var nodes = device.NodeMaps[NodeMapNames.Device];
var pixelFormat = nodes["PixelFormat"] as EnumerationNode;
try
{
// this is an example for changing buffer size with a
// nodemap entry (assume that Mono10 is supported)
pixelFormat.Value = "Mono10";
}
catch
{
// handle the error if setting the value failed
}
// update the flow_set_pool (buffers)
stream.DeregisterFlowSetPool();
Console.WriteLine($"Pixel format set to: {pixelFormat.Value}");
stream.Start();
for (int i = 0; i < 10; i++)
{
WaitStatus status;
using (var composite = stream.Wait(out status))
{
using (var nodeMaps = NodeMapDictionary.FromImage(composite))
{
Console.WriteLine($"Acquired image: {i}");
}
}
}
stream.Abort();
}
}
}
}
}
static Device Open(DiscoveryInformation info, AcquisitionStack acquisitionStack=AcquisitionStack.PreferVin)
static DiscoveryInformationList Discover()
WaitStatus