导航:首页 > 编程语言 > 摄像头编写程序

摄像头编写程序

发布时间:2023-07-16 18:29:43

⑴ 谁有用delphi编写的用于控制摄像头录像并且保存的程序代码,发给我一个,不胜感激!越快越好……

unit ControlMonitor;
interface
uses Messages, Windows, SysUtils, Forms;
function OpenMonitor(Left, Top, Width, Height: Integer; Handle: HWND): Boolean;
function CloseMonitor(): Boolean;
function Capture(FileName: String): Boolean;
function BeginRecord(FileName: String): Boolean;
function EndRecord(): Boolean;
implementation
var
hWndC : THandle;
const WM_CAP_START = WM_USER;
const WM_CAP_STOP = WM_CAP_START + 68;
const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;
const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11;
const WM_CAP_SAVEDIB = WM_CAP_START + 25;
const WM_CAP_GRAB_FRAME = WM_CAP_START + 60;
const WM_CAP_SEQUENCE = WM_CAP_START + 62;
const WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;
const WM_CAP_SEQUENCE_NOFILE =WM_CAP_START+ 63;
const WM_CAP_SET_OVERLAY =WM_CAP_START+ 51;
const WM_CAP_SET_PREVIEW =WM_CAP_START+ 50;
const WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START +6;
const WM_CAP_SET_CALLBACK_ERROR=WM_CAP_START +2;
const WM_CAP_SET_CALLBACK_STATUSA= WM_CAP_START +3;
const WM_CAP_SET_CALLBACK_FRAME= WM_CAP_START +5;
const WM_CAP_SET_SCALE=WM_CAP_START+ 53;
const WM_CAP_SET_PREVIEWRATE=WM_CAP_START+ 52;
function capCreateCaptureWindowA(lpszWindowName : PCHAR; dwStyle : longint;x : integer;y : integer;nWidth : integer; nHeight : integer;ParentWin : HWND;nId : integer): HWND; STDCALL EXTERNAL
'AVICAP32.DLL';
//打开
function OpenMonitor(Left, Top, Width, Height: Integer; Handle: HWND): Boolean;
begin
Result := False;
try
hWndC := capCreateCaptureWindowA('My Own Capture Window',
WS_CHILD or WS_VISIBLE ,
Left,
Top,
Width,
Height,
Handle,
0);
hWndC := capCreateCaptureWindowA('My Own Capture Window',
WS_CHILD or WS_VISIBLE ,
Left,
Top,
Width,
Height,
Handle,0);
if hWndC <> 0 then
begin
SendMessage(hWndC, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
SendMessage(hWndC, WM_CAP_SET_CALLBACK_ERROR, 0, 0);
SendMessage(hWndC, WM_CAP_SET_CALLBACK_STATUSA, 0, 0);
SendMessage(hWndC, WM_CAP_DRIVER_CONNECT, 0, 0);
SendMessage(hWndC, WM_CAP_SET_SCALE, 1, 0);
SendMessage(hWndC, WM_CAP_SET_PREVIEWRATE, 66, 0);
SendMessage(hWndC, WM_CAP_SET_OVERLAY, 1, 0);
SendMessage(hWndC, WM_CAP_SET_PREVIEW, 1, 0);
Result := True;
end;
except
on E: Exception do
begin
MessageBox(Application.Handle, PChar(E.Message), '错误', MB_OK OR MB_ICONERROR);
Result := False;
end;
end;
end;

//关闭
function CloseMonitor(): Boolean;
begin
Result := False;
try
if hWndC <> 0 then
begin
SendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0);
hWndC := 0;
Result := True;
end;
except
on E: Exception do
begin
MessageBox(Application.Handle, PChar(E.Message), '错误', MB_OK OR MB_ICONERROR);
Result := False;
end;
end;
end;

//截图
function Capture(FileName: String): Boolean;
begin
Result := False;
if hWndC <> 0 then
begin
SendMessage(hWndC, WM_CAP_SAVEDIB, 0, longint(pchar(FileName)));
Result := True;
end;
end;
//开始录制
function BeginRecord(FileName: String): Boolean;
begin
Result := False;
try
if hWndC <> 0 then
begin
SendMessage(hWndC,WM_CAP_FILE_SET_CAPTURE_FILEA,0, Longint(pchar(FileName)));
SendMessage(hWndC, WM_CAP_SEQUENCE, 0, 0);
Result := True;
end;
except
on E: Exception do
begin
MessageBox(Application.Handle, PChar(E.Message), '错误', MB_OK OR MB_ICONERROR);
Result := False;
end;
end;
end;
//结束录制
function EndRecord(): Boolean;
begin
Result := False;
if hWndC <> 0 then
begin
SendMessage(hWndC, WM_CAP_STOP, 0, 0);
Result := True;
end;
end;
end.

⑵ 电脑上有多个摄像头时。怎样编写一个java程序调用我指定的那个摄像头

先下载jfm安装好,里面可以里面可以看到你有哪些摄像头驱动的,还可以对每个回摄像头进行设答置
你要用java进行摄像头开发必须先下载安装jmf.
比如:
captureDeviceInfo = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0"); // 加载驱动
这个加载的驱动名称就是和jfm中的驱动对应的,如果你有其他摄像头在jmf中可以看到驱动的,直接加载那个驱动就可以了

⑶ delphi 利用简易摄像头编写监控的程序

可能是监视界面图像需要刷新吧,每个时刻都在变化,需要调用RePaint方法。

阅读全文

与摄像头编写程序相关的资料

热点内容
股票数据放哪里 浏览:576
m格式库文件 浏览:279
天际通数据服务怎么开票 浏览:430
写小说发哪个网站比较好 浏览:244
小米电视3蓝牙文件路径 浏览:111
shell读取文件值 浏览:909
文件夹路径栏消失 浏览:795
律师哪些业务不能代替大数据 浏览:952
lol哪些文件可以删除 浏览:701
汇编程序中del是什么意思 浏览:183
幼儿园免费网站模板下载 浏览:210
w619线刷教程 浏览:759
怎么培养编程思想 浏览:697
手机捆绑app的软件怎么卸载 浏览:32
vb编程器有什么用 浏览:999
excel如何分列数据与文字 浏览:884
512网络病毒 浏览:994
java调用google地图api接口 浏览:726
文件管理图片小窗 浏览:599
显卡数据怎么设置 浏览:557

友情链接