Frame Grabber SDK (Windows-C) Developer Guide
// Save the original image data.
void SaveRawImage(int nImageNo, MV_FG_BUFFER_INFO* pstImageInfo)
{
if (pstImageInfo)
{
char szFileName[FILE_NAME_LEN] = { 0 };
sprintf_s(szFileName, FILE_NAME_LEN, "Image_w%d_h%d_n%d.raw", pstImageInfo->nWidth,
pstImageInfo->nHeight, nImageNo);
FILE* pImageFile = NULL;
if ((0 != fopen_s(&pImageFile, szFileName, "wb")) || (NULL == pImageFile))
{
return;
}
fwrite(pstImageInfo->pBuffer, 1, pstImageInfo->nFilledSize, pImageFile);
fclose(pImageFile);
}
}
// Image acquisition thread.
unsigned int __stdcall GrabbingThread(void* pUser)
{
if (pUser)
{
MultiThrParam*
pstThreadParam = (MultiThrParam*)pUser;
MV_FG_BUFFER_INFO stFrameInfo = { 0 };
// Image information
int
nSaveImage
= 0;
// Number of saved images
int
nRet
= 0;
DLL_StartAcquisition DLLStartAcquisition =
(DLL_StartAcquisition)GetProcAddress(pstThreadParam->hDll, "MV_FG_StartAcquisition");
DLL_GetFrameBuffer DLLGetFrameBuffer =
(DLL_GetFrameBuffer)GetProcAddress(pstThreadParam->hDll, "MV_FG_GetFrameBuffer");
DLL_ReleaseFrameBuffer DLLReleaseFrameBuffer =
(DLL_ReleaseFrameBuffer)GetProcAddress(pstThreadParam->hDll, "MV_FG_ReleaseFrameBuffer");
DLL_StopAcquisition DLLStopAcquisition =
(DLL_StopAcquisition)GetProcAddress(pstThreadParam->hDll, "MV_FG_StopAcquisition");
// Start image acquisition.
nRet = DLLStartAcquisition(pstThreadParam->pUser);
if (MV_FG_SUCCESS != nRet)
{
printf("Start acquistion failed! %#x\n", nRet);
return nRet;
}
g_bExit = false;
while (!g_bExit)
{
121
    "