Reading ChunkEncoderValue from AT C5

Hi Simon,

thanks a lot for your solution. It works fine (I didn’t test performance yet though).

I just want to add my two cents regarding using GenICam.vin driver. One can also set AttachChunk programmatically if she opens device using Discover. I myself prefer Discover option as it permits to select device using info like IP address, etc. (not just CVB channel number). Here is the example:

// Select device by serial number, IP address, etc...
// Selecting first device here to be short.
DiscoveryInformationList foundDevices = DeviceFactory.Discover();
var selectedDevice = foundDevices[0];

// Set CVB color format to "Raw".
// I suppose we need this when working with chunks.
selectedDevice.SetParameter("PixelFormat", "0");

// Turn on "Attach chunk" parameter, so that chunk
// nodes become readable.
selectedDevice.SetParameter("AttachChunk", "1");

// Open device and configure chunk mode.
var device = DeviceFactory.Open(selectedDevice);
var deviceNodeMap = device.NodeMaps[NodeMapNames.Device];
var chunkModeActive = deviceNodeMap["ChunkModeActive"] as IBooleanNode;
chunkModeActive.Value = true;

// Read encoder value(s) along with image.
CvbStream stream = device.Stream;
stream.Start();
try
{
    using (StreamImage image = stream.Wait())
    {
        var encoderValues = new List<long>();
        var scanLineSelector = deviceNodeMap["ChunkScanLineSelector"] as IntegerNode;
        for (var scanLine = scanLineSelector.Min; scanLine <= scanLineSelector.Max; scanLine += scanLineSelector.Increment)
        {
            scanLineSelector.Value = scanLine;
            var encoderValueNode = deviceNodeMap["ChunkEncoderValue"] as IntegerNode;
            encoderValues.Add(encoderValueNode.Value);
        }
    }
}
finally
{
    stream.Stop();
}

Credit to this post for example of setting driver parameters.

2 Likes