<< Click to Display Table of Contents >> Navigation: CVB with GenICam > SDK > Retrieving time stamps > Get image timestamp - GenICam driver |
Purpose:
This time stamp is used for example to archive images acquired together with the acquisition time.
There are different possibilities to retrieve the time stamp
As a recommendation please use the IDeviceControl Interface of the CVB GenICam driver to retrieve the time stamp.
1 |
|
|
|
|
|
|
|
2 |
|
|
|
3 |
|
The favourite method is to retrieve the time stamp via the IDeviceControl interface supported by the GenICam.vin driver.
Please use the command DCBinaryCommand or DCStringCommand of the CVCDriver.dll to retrieve the time stamp as a 64 Bit long value.
Especially for VB.Net DCStringCommand should be used.
The command ID (0x800, DC_GET) must be sent to the driver.
The value 800 must be given in hexadecimal.
Dim Param As String Dim str As String = "" Dim iCmd As Long Dim iResult As Long Dim iOutStrSize As Long Dim pOutString As String Dim lTimestamp As Long
' set command ID; the parameter constant timestamp (&H800) can be retrieved from the header file ' Lib\C\iDC_GenICam.h iCmd = Cvb.Driver.IDeviceControl.DeviceCtrlCmd(&H800, Cvb.Driver.IDeviceControl.DC_OPERATION.GET)
' retrieve the size of the output buffer m_cvGrabber.SendStringCommand(iCmd, Param, "", _iSize) m_cvGrabber.SendStringCommand(iCmd, Param, pOutString, _iSize)
' In the variable pOutString the current timestamp value is retrieved. ' parse hex string to decimal long timestamp value pOutString = pOutString.Replace("0x", "").ToUpper() Long.TryParse(pOutString, Globalization.NumberStyles.HexNumber, Application.CurrentCulture, lTimestamp) |
Using the CV Grabber Control please call the method SendBinaryCommand (…) or SendStringCommand (…).
The time stamp is retrieved as a hex String value and must be converted to a 64 bit value.
For VB.Net the SendStringCommand must be used.
The command ID (0x800, DC_GET) must be sent to the driver.
The value 800 must be given in hexadecimal (see VB.Net Example below).
// includes #include iDC_GenICam.h
long outSize = sizeof(__int64); __int64 outParam = 0;
// Send command with the parameter constant timestamp (&H800) see iDC_GenICam.h if (m_cvGrabber.SendBinaryCommand(DeviceCtrlCmd(0x00000800, DC_GET), NULL, 0, reinterpret_cast<long*>(&outParam), &outSize)) { // Print timestamp value cout << " Timestamp: " << outParam; } |
With the function G2GetGrabStatus (GRAB_INFO_TIMESTAMP ) of the CVCDriver.dll or the GetGrab2Status method of the CV Image Control the time stamp value can be retrieved as double value.
Note that the internal time stamp is an int64 type which means that you loose accuracy when you retrieve the time stamp value with the IGrab2 Interface.
For more accuracy of the time stamp value please use the IDeviceControl Interface for GenICam compliant devices.
Another possibility is to use the CV RingBuffer control and call the method GetTimestamp to retrieve the 64 bit time stamp value of type long, when the image is acquired by the camera.