[c\c++] webcam snapshot in memory...

i would like to find a way of taking a snapshot from the webcam...
1
2
3
4
    HWND hwnd = capCreateCaptureWindow("Explorer", WS_ICONIC, 0, 0, 200, 200, NULL, 0);
	capDriverConnect(hwnd, 0);
	capGrabFrameNoStop(hwnd);
	capFileSaveDIB(hwnd, "a.bmp");

consulting msdn i've been able to write this simple code...
it works, but it saves the snapshot in a file.

I would like to get the snapshot in a buffer and not in a file...

my final aim is to build a program that takes the income images, modifies them and shows the modified ones instead of the original income images.
so i need to get the images in a buffer because it will be much more fast to modify them.

thanks,
Marco
Well where you have the line capFileSaveDIB(hwnd, "a.bmp");
could you not do something where you store it in an array? Or, you could open the bitmap as a file (open with "rb" (read-only, binary)) and then store the contents in a buffer?

Edit: As you want to modify it you'd open it as "wb" (writable, binary).
Last edited on
Topic archived. No new replies allowed.