Hi everyone, here I have a problem which is very urgent and I couldn't resolve during the past three days. It can be simplified as below:
typedef struct _tagBufferStatus
{
long BufferCount;
byte** Buffer;
...
}StructBufferStatus;
int nIndex = 0;
byte *pIn;
BITMAPFILEHEADER bmfHdr;
BITMAPINFOHEADER bmiHdr;
LPBITMAPIINFO lpbmi;
StructCurrentImageSize structCurImg = MS_GetCurrentImageSize(g_CameraID,&status);
int cxWidth = structCurImg.ImageWidthFromCamera;
int cyHeight = structCurImg.ImageHeightFromCamera;
DWORD memSize = cxWidth*cyHeight;
byte *pOut= new byte[memSize];
ZeroMemory(pOut,memSize);
LPBITMAPINFO lpbmi;
DWORD BitmapInfoSize;
MS_CreateDIBHeader(g_CameraID,&lpbmi,&BitmapInfoSize,&status);
DWORD dwSize = lpbmi->bmiHeader.biSizeImage;
static StructBufferStatus structBufStatus = MS_GetBufferStatus(g_CameraID,&status);
StructCaptureStatus structCapStatus = MS_GetCaptureStatus(g_CameraID,&status);
nIndex = structBufStatus.LastValidFrame;
byte **pTemp = structBufStatus.ImageBuffers;
pIn = pTemp[nIndex];
MS_GetGrayscaleImage(g_CameraID,pIn,pOut,&status);
bmfHdr.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD);
bmfHdr.bfReserved1 =0;
bmfHdr.bfReserved2 =0;
bmfHdr.bfSize = memSize +sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + 256*sizeof(RGBQUAD);
bmfHdr.bfType = 0x4d42;
memcpy(&bmiHdr,lpbmi,sizeof(BITMAPINFOHEADER));
SavetoBMP(bmfHdr,bmiHdr,pOut);
In this case, function
StructImageBuffer GetImageBuffer(long CameraID) is provided for the purpose of retrieving a pointer to a series of image buffer. As each image buffer is represented by a pointer,we need a pointer pointer to get the starting address of image buffer series.
use function
GetImage(long CameraID,byte *pSrc,byte *pDst) to store an image data in pDst, where pSrc points to one of the image buffer in the image buffer series.
here,the problem is : the two functions is provdied by DLL,and ImageBuffer is reserved by DLL,and I can't copy data from Buffer to pDst. Is there anyone who has encountered the same problem and is kindly enough to give me a hand? All the thanks!