关于videocap控件的问题...(200分)

  • 主题发起人 主题发起人 youhe
  • 开始时间 开始时间
Y

youhe

Unregistered / Unconfirmed
GUEST, unregistred user!
各位高手们,本人想在delphi里开发一个数码拍照摄像的程序(有取景框,可来去推动锁定摄像机所摄取的图像,而后确定保存图像,格式如1寸照片大小)


今天下载了videocap控件及范例:http://www.8421.org/download/vcl/other_videocap23.zip,
不知道videocap的使用,没有帮助文件,修改无从入手,在此想请各位帮帮忙,给指点指点,高手相送,谢谢!
 
用dspack2.1解决吧,给你一个访问的例子,其它控制的你可以参考dspack2.1中的其它demo!

unit main;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, DSUtil, StdCtrls, DSPack, DirectShow, Menus;

type
TVideoForm = class(TForm)
FilterGraph: TFilterGraph;
VideoWindow: TVideoWindow;
MainMenu1: TMainMenu;
Devices: TMenuItem;
Filter: TFilter;
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
private
{ D閏larations priv閑s }
public
{ D閏larations publiques }
procedure OnSelectDevice(sender: TObject);
end;


var
VideoForm: TVideoForm;
SysDev: TSysDevEnum;
implementation

{$R *.dfm}

procedure TVideoForm.FormCreate(Sender: TObject);
var
i: integer;
Device: TMenuItem;
begin

SysDev:= TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
if SysDev.CountFilters > 0 then

for i := 0 to SysDev.CountFilters - 1do

begin

Device := TMenuItem.Create(Devices);
Device.Caption := SysDev.Filters.FriendlyName;
Device.Tag := i;
Device.OnClick := OnSelectDevice;
Devices.Add(Device);
end;

end;


procedure TVideoForm.OnSelectDevice(sender: TObject);
var
CaptureGraph: ICaptureGraphBuilder2;
SourceFilter, DestFilter: IBaseFilter;
begin

FilterGraph.ClearGraph;
FilterGraph.Active := false;
Filter.BaseFilter.Moniker := SysDev.GetMoniker(TMenuItem(Sender).tag);
FilterGraph.Active := true;
FilterGraph.QueryInterface(ICaptureGraphBuilder2, CaptureGraph);
Filter.QueryInterface(IBaseFilter, SourceFilter);
VideoWindow.QueryInterface(IBaseFilter, DestFilter);
CaptureGraph.RenderStream(nil, nil, SourceFilter, nil, DestFilter);
FilterGraph.Play;
CaptureGraph := nil;
SourceFilter := nil;
DestFilter := nil;
end;


procedure TVideoForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin

SysDev.Free;
FilterGraph.ClearGraph;
FilterGraph.Active := false;
end;


end.
 
dspack可以截取视频吗?它是怎样控制摄像头拍下的视频流的了,或者说还需要视频卡。
到底是怎的一回事了。
 
首先保证射像头驱动已经安装 然后放置 VideoCap控件

得到视频头

Com2.Items:= GetDriverList;

启动视频头

if not VideoCap1.DriverOpen then

begin

videoCap1.DriverIndex:=strtoint(str_drv)
VideoCap1.DriverOpen:= True;

// VideoCap1.Videopreview:= True;
// VideoCap1.visible:=true
End

截获照片
VideoCap1.GrabFrameNoStop;
VideoCap1.SaveToClipboard;

bmp:=Tbitmap.Create

bmp.LoadFromClipboardFormat(cf_BitMap,ClipBoard.GetAsHandle(cf_Bitmap),0)

 
后退
顶部