Jak przechwycić klatkę obrazu z kamery , narysować coś na niej i ją wyświetlić ?
Jak przechwycić wideo kawałek kodu poniżej tyle że na tym obrazie sie nie da rysować :(
Ktoś może ma jakieś pomysły ?
// ze strony http://www.entwickler-ecke.de/topic_Problem+mit+capCreateCaptureWindow+unter+Windows+7_107596,0.html
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
const
WM_CAP_DRIVER_CONNECT = WM_USER + 10;
WM_CAP_DRIVER_DISCONNECT = WM_USER + 11;
WM_CAP_EDIT_COPY = WM_USER + 30;
WM_CAP_DLG_VIDEOSOURCE = WM_USER + 42;
WM_CAP_SET_PREVIEW = WM_USER + 50;
WM_CAP_SET_OVERLAY = WM_USER + 51;
WM_CAP_SET_PREVIEWRATE = WM_USER + 52;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
vhandle: THandle;
implementation
{$R *.dfm}
function capCreateCaptureWindow(lpszWindowName: LPCSTR;
dwStyle: DWORD;
x, y,
nWidth,
nHeight: integer;
hwndParent: HWND;
nID: integer): HWND; stdcall;
external 'AVICAP32.DLL' name 'capCreateCaptureWindowA';
procedure TForm1.Button1Click(Sender: TObject);
begin
if vhandle <= 0 then begin
vhandle := capCreateCaptureWindow('Video',ws_child+ws_visible, 8, 8, 180, 240, Form1.Handle, 1);
end;
SendMessage(vhandle, WM_CAP_DRIVER_CONNECT, 0, 0);
SendMessage(vhandle, WM_CAP_SET_PREVIEWRATE, 30, 0);
SendMessage(vhandle, WM_CAP_SET_OVERLAY, 1, 0);
SendMessage(vhandle, WM_CAP_SET_PREVIEW, 1, 0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
SendMessage(vhandle, WM_CAP_SET_PREVIEW, 0, 0);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
SendMessage(vhandle, WM_CAP_DRIVER_DISCONNECT, 0, 0);
end;
end.
Ewentualne rozwiazanie za pomoca schowka (ale to raczej brzydka metoda)
http://www.codeproject.com/Articles/7882/Easy-Digital-Camera-Connection