Chunk data#
Opto Engineering cameras can append additional information to image data, arranged in chunks. Examples of common chunk data sent with image data are exposure time, image width and height, gain and many other. Each value refers of course to the image it’s sent with. Each chunk stored with the image is represented by a GenICam feature and it can be retrieved by calling the IMG_GetChunkNode()
function with the H_IMAGE
handle.
First of all, chunk data functionality must be manually enabled via the device nodemap.
//Enable chunk data
H_NODE hNodeChunkModeActive = NULL;
error = NODEMAP_GetNode(hNodeMap, "ChunkModeActive", &hNodeChunkModeActive);
error = NODE_BooleanSetValue(hNodeChunkModeActive, true);
Single chunks (each one provided by a dedicated node) can be enabled or disabled individually. The ChunkSelector
node allows the client code to select the desired chunk and then enable or disable it via ChunkEnable
. For example, let’s enable the exposure time chunk.
//Get the node for chunk data selection and select exposure time chunk
error = NODEMAP_GetNode(hNodeMap, "ChunkSelector", &hNodeChunkSelector);
error = NODE_FromString(hNodeChunkSelector, "ChunkExposureTime");
//Enable the exposure time chunk data
error = NODEMAP_GetNode(hNodeMap, "ChunkEnable", &hNodeChunkEnable);
error = NODE_BooleanSetValue(hNodeChunkEnable, true);
When a new image is grabbed, the chunk data nodes can be accessed via its interface.
H_IMAGE hImage = NULL;
error = DEV_GetNextImage(hDevice, 500, &hImage);
bool hasChunckData = false;
error = IMG_HasChunkData(hImage, &hasChunckData);
H_NODE hNodeExposureTime = NULL;
if(hasChunckData){
//Read the chunk value, automatically updated by ItalaApi after grab
error = IMG_GetChunkNode(hImage, "ChunkExposureTime", &hNodeExposureTime);
float exposureTime = 0;
error = NODE_FloatGetValue(hNodeExposureTime, &exposureTime);
printf("Current exposure time is %f\n", exposureTime);
}
error = IMG_Dispose(hImage);
hImage = NULL;
Note
Chunk feature names and types are also standardized by SFNC (Standard Feature Naming Convention), which is part of the GenICam standard. Please refer to the official SFNC document to gather information about a particular chunk. Refer to the official GenICam document to find a more in-depth description of the standard. All the material is freely accessible from the GenICam Introduction page.