Retrieving Images

Retrieving images

Allocate a buffer and retrieve the current live image.

First, retrieve the data size for the current resolution with “PUC_GetXferDataSize”.

result = PUC_GetXferDataSize(hDevice, &nDataSize);
if (PUC_CHK_FAILED(result))
{
    return;
}

Note

  • The image transferred from the camera is a compressed image. In the example above, the data size of the compressed image will be retrieved.

  • When allocating a buffer for the size retrieved with PUC_GetXferDataSize, the buffer will need to be reallocated every time the resolution is changed. Using PUC_GetMaxXferDataSize to allocate the maximum data size in advance facilitates this process.

Next, allocate a buffer and retrieve the image.

PUC_XFER_DATA_INFO xferData = { 0 };

xferData.pData = new UINT8[nDataSize];

result = PUC_GetSingleXferData(hDevice, &xferData);
if (PUC_CHK_FAILED(result))
{
    return;
}

Note

  • The size of the actual transferred image is stored to xferData.nDataSize, and the sequence number is stored to xferData.nSequenceNo.

  • As the retrieved image has been compressed, it will need to be decoded in order to view it.