Hi @Mikael,
there are multiple reasons why this is not working.
Using the EndOfLineMetadata of the Linea differs from handling Metadata/Chunk Data from different camera models.
In case of the Linea EndOfLineMetadata means that all information is added to the camera image using the last pixels for each line. The number of used pixels is depending on the number and type of activated metadata.
Here are example images from the Linea grabbed using the GenICam Browser:
Without Metadata:
With Metadata Active (ExposureTime and Timestamp):
The number of pixels per line stays equal to 2048 for the Linea 2K, so you will loose information from the pixels used for Metadata.
Now extracting these data from code in CVB could look like this:
using Stemmer.Cvb;
using Stemmer.Cvb.Driver;
using Stemmer.Cvb.GenApi;
namespace CVB_LineaMetadata
{
internal class Program
{
static void Main(string[] args)
{
DiscoveryInformationList discoveryList = DeviceFactory.Discover(DiscoverFlags.IgnoreVins);
if (discoveryList[0].AccessToken.Contains("Linea"))
{
//discoveryList[0].SetParameter("AttachChunk", "1");
//Open Linea using GenTL
using (Device device = DeviceFactory.Open(discoveryList[0]))
{
Stream stream = device.Stream;
NodeMap nodemap = device.NodeMaps[NodeMapNames.Device];
//Activating Metadata
EnumerationNode metadatamode = nodemap["Cust::endOfLineMetadataMode"] as EnumerationNode;
metadatamode.Value = "Active";
EnumerationNode metadataContentSelector = nodemap["Cust::endOfLineMetadataContentSelector"] as EnumerationNode;
EnumerationNode metadataContentActivationMode = nodemap["endOfLineMetadataContentActivationMode"] as EnumerationNode;
metadataContentSelector.Value = "ExposureTime";
metadataContentActivationMode.Value = "True";
metadataContentSelector.Value = "Timestamp";
metadataContentActivationMode.Value = "True";
//Get Metadata Size
long metadataPixelCount = (nodemap["Cust::endOfLineMetadataPixelCount"] as IntegerNode).Value;
//Get Line Width
long linewidth = (nodemap["Std::Width"] as IntegerNode).Value;
long imageheight = (nodemap["Std::Height"] as IntegerNode).Value;
byte[,] metadata = new byte[imageheight, metadataPixelCount];
int offsetMetadata = (int)(linewidth - 1 - metadataPixelCount);
//Start Stream
stream.Start();
for (int i = 0; i < 10; i++)
{
using(Image image = stream.Wait())
{
LinearAccessData<byte> imageData = image.Planes[0].GetLinearAccess<byte>();
for(int y = 0; y < imageheight; y++)
{
for(int x = 0; x < metadataPixelCount; x++)
{
metadata[y,x] = imageData[(x+ offsetMetadata), y];
}
}
//Decode Metadata...
}
}
stream.Abort();
}
}
}
}
}
Note that Chunk Data do not need to be activated on the driver side as theese are not Chunk Data in this context and just data that are written to the transmitted image.
To receive the FrameTriggerTimestamp you would need to use a completely different approach.
You will need to use Event handling to receive Cust::EventValidFrameTriggerTimestamp for each valid frame trigger. How to use event data, please have a look here.