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

摄像头编写程序

发布时间: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方法。

阅读全文

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

热点内容
电脑版上传视频找不到文件在哪 浏览:164
javastringtemplate 浏览:594
联想启天m7300能升级内存吗 浏览:698
精雕怎么打开图片文件 浏览:161
ug编程镗孔g76如何使用 浏览:719
7岁到18岁少儿编程学什么 浏览:413
mac文件怎么打印 浏览:756
农药登记许可证查询哪个网站 浏览:857
素材站用什么网站系统 浏览:173
ug如何用铰刀编程 浏览:647
三国志版本介绍 浏览:260
情侣用的定位app有哪些 浏览:244
怎么清楚苹果手机的健身数据 浏览:988
淘宝美工教程自学网 浏览:452
父子2006未删减版本 浏览:872
包头谁卖苹果6 浏览:504
化工企业停工有哪些文件通知要求 浏览:878
下载软件后文件夹在桌面 浏览:397
word文字编组 浏览:167
旅游策划的程序 浏览:519

友情链接