Y
Y
Yozhik_v_tumane2019-03-23 16:48:06
C++ / C#
Yozhik_v_tumane, 2019-03-23 16:48:06

How to put the image from the camera into the buffer?

Good afternoon. I need to get an image and place its content in a buffer. Found how to save it to a file. And how to put in the buffer?

Cap = capCreateCaptureWindow(L".", WS_CHILD | WS_VISIBLE, 0, 0, 320, 240, GetDesktopWindow(), 0);
if (!Cap)
  return false;

if (!SendMessage(Cap, WM_CAP_DRIVER_CONNECT, 0, 0L)) {
  DestroyWindow(Cap);
  return;
}

SendMessage(Cap, WM_CAP_SET_PREVIEW, 0, 0); 
SendMessage(Cap, WM_CAP_FILE_SAVEDIB, 0, (LPARAM)szFile); //save to file
SendMessage(Cap, WM_CAP_DRIVER_DISCONNECT, 0, 0);
DestroyWindow(Cap);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SerJook, 2019-03-23
@SerJook

Your code does not work for me on Windows 8.1 (the device selection window appears and that's it).
If you want to put an image on the clipboard, send a WM_CAP_EDIT_COPY message .
If you want to access the image pixels directly, try setting the WM_CAP_SET_CALLBACK_FRAME callback .
But I would advise you to use DirectShow instead of this old API.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question