
Frame Grabber SDK (Windows-C) Developer Guide
{
MV_FG_PIXEL_TYPE enDstPixelType = MV_FG_PIXEL_TYPE_Undefined;
unsigned int nChannelNum = 0;
char szFileName[FILE_NAME_LEN] = { 0 };
FILE* pImageFile = NULL;
SYSTEMTIME sys;
GetLocalTime(&sys);
// If in color format, convert to RGB8.
if (IsColorPixelFormat(stFrameInfo.enPixelType))
{
nChannelNum = 3;
enDstPixelType = MV_FG_PIXEL_TYPE_RGB8_Packed;
sprintf_s(szFileName, FILE_NAME_LEN,
"After_%04d%02d%02d%02d%02d%02d%03d.rgb", sys.wYear, sys.wMonth,
sys.wDay, sys.wHour, sys.wMinute, sys.wSecond, sys.wMilliseconds);
}
//If in monochrome format, convert to Mono8.
else if (IsMonoPixelFormat(stFrameInfo.enPixelType))
{
nChannelNum = 1;
enDstPixelType = MV_FG_PIXEL_TYPE_Mono8;
sprintf_s(szFileName, FILE_NAME_LEN,
"After_%04d%02d%02d%02d%02d%02d%03d.gray", sys.wYear, sys.wMonth,
sys.wDay, sys.wHour, sys.wMinute, sys.wSecond, sys.wMilliseconds);
}
else
{
printf("Don't need to convert!\n");
}
if (enDstPixelType != MV_FG_PIXEL_TYPE_Undefined)
{
stConvertPixelInfo.stInputImageInfo.pImageBuf = (unsigned
char*)stFrameInfo.pBuffer;
stConvertPixelInfo.stInputImageInfo.nImageBufLen =
stFrameInfo.nFilledSize;
stConvertPixelInfo.stInputImageInfo.nHeight = stFrameInfo.nHeight;
stConvertPixelInfo.stInputImageInfo.nWidth = stFrameInfo.nWidth;
stConvertPixelInfo.stInputImageInfo.enPixelType =
stFrameInfo.enPixelType;
nChannelNum;
unsigned int nSize = stFrameInfo.nHeight * stFrameInfo.nWidth *
if (nSize > stConvertPixelInfo.stOutputImageInfo.nImageBufSize)
{
if (stConvertPixelInfo.stOutputImageInfo.pImageBuf)
{
free(stConvertPixelInfo.stOutputImageInfo.pImageBuf);
stConvertPixelInfo.stOutputImageInfo.pImageBuf = NULL;
99





















































































































































