
Frame Grabber SDK (Windows-C) Developer Guide
char*)malloc(nSize);
}
stConvertPixelInfo.stOutputImageInfo.pImageBuf = (unsigned
if (NULL == stConvertPixelInfo.stOutputImageInfo.pImageBuf)
{
printf("malloc pConvertData fail!\n");
nRet = MV_FG_ERR_RESOURCE_EXHAUSTED;
break;
}
stConvertPixelInfo.stOutputImageInfo.nImageBufSize = nSize;
}
stConvertPixelInfo.stOutputImageInfo.nImageBufLen = 0;
stConvertPixelInfo.stOutputImageInfo.enPixelType = enDstPixelType;
stConvertPixelInfo.enCfaMethod = MV_FG_CFA_METHOD_OPTIMAL;
nRet = MV_FG_ConvertPixelType(hStream, &stConvertPixelInfo);
if (MV_FG_SUCCESS != nRet)
{
printf("Convert Pixel Type fail! nRet [0x%x]\n", nRet);
continue;
}
if ((0 != fopen_s(&pImageFile, szFileName, "wb")) || (NULL == pImageFile))
{
continue;
}
fwrite(stConvertPixelInfo.stOutputImageInfo.pImageBuf, 1,
stConvertPixelInfo.stOutputImageInfo.nImageBufLen, pImageFile);
fclose(pImageFile);
printf("Convert pixeltype succeed\n");
}
}
}
// Insert the buffer back to the input queue.
nRet = MV_FG_ReleaseFrameBuffer(hStream, &stFrameInfo);
if (MV_FG_SUCCESS != nRet)
{
printf("Release frame buffer failed! %#x\n", nRet);
break;
}
}
if (stConvertPixelInfo.stOutputImageInfo.pImageBuf)
{
free(stConvertPixelInfo.stOutputImageInfo.pImageBuf);
stConvertPixelInfo.stOutputImageInfo.pImageBuf = NULL;
}
100





















































































































































