CreateFromArray quit working

http://www.xdp.it/cgi-bin/yabb2/YaBB.pl?num=1132285336

Hi Davide
First thanks for this software - its great!

I was working with CxImage for couple of months, and it works great. In some point it quit. I call CreateFromArray and it does nothing to the object. GetLastError returns an empty string. What I’m doing is convert a buffer I get from my webcam to a jpeg image. I call this function on a callback function from the windows Video Capture.
I did not change a thing in my code or linking.
Here is the relevant part of the code:
Code:

LRESULT PASCAL FrameCallbackProc (HWND hWnd, LPVIDEOHDR lpVHdr)
{
/* Get the Format struct. */
int size = capGetVideoFormatSize (hWnd);
char* format = new char [size];
capGetVideoFormat (hWnd, format, size);

/* Make CxImage from the buffer received from webcam driver.*/
CxImage image;
image.CreateFromArray ((BYTE*)lpVHdr->lpData,
((BITMAPINFO*)format)->bmiHeader.biWidth,
((BITMAPINFO*)format)->bmiHeader.biHeight,
((BITMAPINFO*)format)->bmiHeader.biBitCount,
((BITMAPINFO*)format)->bmiHeader.biWidth *
((BITMAPINFO*)format)->bmiHeader.biBitCount / 8,
FALSE);

...

I do not think the problem is with CxImage but I probably changed some thing in the system. I don't know what.

Did you bump into this problem in the past?

Any lead will be most appreciated
Thanks
Erez Bibi

http://dcru-server.com
Back to top  

Found the problem
The BitPerPixel was set to 12 I had to set it to 24 and set the compression to None.

你可能感兴趣的:(CreateFromArray quit working)