#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#define IMAGE_NAME_LEN 256
{
int c;
while ( (c = getchar()) != '\n' && c != EOF );
fprintf( stderr, "\nPress enter to exit.\n");
while( getchar() != '\n');
sleep(1);
}
{
switch (ePixelType)
{
return true;
default:
return false;
}
}
{
if (NULL == pstMVDevInfo)
{
printf("The Pointer of pstMVDevInfo is NULL!\n");
return false;
}
{
printf("CurrentIp: %d.%d.%d.%d\n" , nIp1, nIp2, nIp3, nIp4);
}
{
}
{
}
{
}
{
}
{
}
else
{
printf("Not support.\n");
}
return true;
}
{
unsigned char* pReconstructBuffer = NULL;
unsigned char* pDstBuf = NULL;
unsigned int nExposureNum = 2;
do
{
{
printf("Initialize SDK fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Enum Devices fail! nRet [0x%x]\n", nRet);
break;
}
{
for (
unsigned int i = 0; i < stDeviceList.
nDeviceNum; i++)
{
printf("[device %d]:\n", i);
if (NULL == pDeviceInfo)
{
break;
}
}
}
else
{
printf("Find No Devices!\n");
break;
}
printf(
"Please Input camera index(0-%d):", stDeviceList.
nDeviceNum - 1);
unsigned int nIndex = 0;
scanf("%d", &nIndex);
{
printf("Input error!\n");
break;
}
{
printf("Create Handle fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Open Device fail! nRet [0x%x]\n", nRet);
break;
}
{
if (nPacketSize > 0)
{
{
printf("Warning: Set Packet Size fail nRet [0x%x]!", nRet);
}
}
else
{
printf("Warning: Get Packet Size fail nRet [0x%x]!", nPacketSize);
}
}
{
printf("Get PayloadSize fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Set MultiLightControl fail,nRet:[%#x]\n", nRet);
}
else
{
printf("Set MultiLightControl to [%d]\n", nExposureNum);
}
nExposureNum = nExposureNum & 0xF;
{
printf("Set Trigger Mode fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Start Grabbing fail! nRet [0x%x]\n", nRet);
break;
}
uint64_t nReconstructBufferSize = 0;
{
printf("Get Image Buffer: Width[%d], Height[%d], FrameNum[%d]\n",
if (bpixel)
{
if (pDstBuf == NULL)
{
pDstBuf = (unsigned char*)malloc(sizeof(unsigned char) * (nPayloadSize * 3));
if (NULL == pDstBuf)
{
printf("malloc pDstData fail !\n");
break;
}
}
{
printf("Decode fail![0x%x]\n", nRet);
break;
}
else
{
printf("HB Decode success!\n");
}
}
else
{
}
nReconstructBufferSize = stImgReconstructionParam.
nSrcDataLen;
pReconstructBuffer = (unsigned char*)malloc(sizeof(unsigned char) * nReconstructBufferSize);
if (NULL == pReconstructBuffer)
{
printf("malloc pReconstructBuffer fail! nRet [0x%x]\n", nRet);
break;
}
unsigned int nSubImageHight = stImgReconstructionParam.
nHeight / nExposureNum;
{
nSubImageHight = nSubImageHight / 2 * 2;
}
uint64_t nSubImageSize = (uint64_t)nRowSize * nSubImageHight;
for (int i = 0; i < nExposureNum; ++i)
{
stImgReconstructionParam.
stDstBufList[i].
pBuf = pReconstructBuffer + i * nSubImageSize;
}
{
printf("Reconstruct Image fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("raw image save to File fail nRet[%x]\n", nRet);
}
else
{
printf("raw image save to File success,save to %s\n", chImageName);
}
for (int i = 0; i < nExposureNum; ++i)
{
}
sprintf(chImageName,
"OutPut_w%d_h%d.bmp", stImage.
nWidth, stImage.
nHeight);
{
printf("After reconstruction SaveImage To File fail nRet[%x]\n", nRet);
}
else
{
printf("After reconstruction SaveImage To File success, save to %s\n", chImageName);
}
{
printf("Free Image Buffer fail! nRet [0x%x]\n", nRet);
}
if (NULL != pReconstructBuffer)
{
free(pReconstructBuffer);
pReconstructBuffer = NULL;
}
if (NULL != pDstBuf)
{
free(pDstBuf);
pDstBuf = NULL;
}
}
else
{
printf("Get Image fail! nRet [0x%x]\n", nRet);
}
{
printf("Stop Grabbing fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("ClosDevice fail! nRet [0x%x]\n", nRet);
break;
}
{
printf("Destroy Handle fail! nRet [0x%x]\n", nRet);
break;
}
} while (0);
{
if (NULL != pDstBuf)
{
free(pDstBuf);
pDstBuf = NULL;
}
if (NULL != pReconstructBuffer)
{
free(pReconstructBuffer);
pReconstructBuffer = NULL;
}
}
{
}
return 0;
}
{
switch (enType)
{
return true;
default:
return false;
}
}
{
return (((enPixelType & 0x00ff0000) >> 16) / 8);
}