Tag: image capture

DirectShow USB网络摄像头改变video源

嘿所有我想在我的网络摄像头上找到将我的video源更改为“复合”的设置。 似乎如果我拔下USB然后将其重新插入并启动代码,它就会出现一个空白屏幕。 但是,一旦我更改了video源(在另一个程序中),然后返回并再次运行我的代码,它就会显示出来。 所以我需要一些东西,允许我改变它,以便同样的事情发生,但在我自己的应用程序内,而无需启动另一个具有该function来设置网络摄像头的程序。 当我拔出USB线然后重新插入并运行源代码时,应用程序的图片框为黑色。 我用来改变video源的“其他程序”(似乎可以调出图像): 在我使用“其他程序”后,我回到源代码并运行它,这就是我得到的: 我从这里使用名为dot Net Webcam Library的C#代码:在此处输入链接描述 它似乎使用DirectShow从这里输入链接描述 我在源代码中注意到它列出了不同类型的video设置(在下面的AXExtend.cs中找到): public enum PhysicalConnectorType { Video_Tuner = 1, Video_Composite, Video_SVideo, Video_RGB, Video_YRYBY, Video_SerialDigital, Video_ParallelDigital, Video_SCSI, Video_AUX, Video_1394, Video_USB, Video_VideoDecoder, Video_VideoEncoder, Video_SCART, Video_Black, Audio_Tuner = 0x1000, Audio_Line, Audio_Mic, Audio_AESDigital, Audio_SPDIFDigital, Audio_SCSI, Audio_AUX, Audio_1394, Audio_USB, Audio_AudioDecoder, } 但我不确定如何在代码中调用它: Device selectedDevice = device as Device; imageCapture.Device […]

用c#捕捉游戏画面的最快方法(每秒超过20张图像)

如何快速制作整个游戏画面的大屏幕? 像每秒20-30的东西?(我想将它们转换为video) [[1]]我尝试过WMEncoder。结果是WMEncoder只能使用一组预先配置的编解码器以video格式(wma)捕获屏幕和屏幕区域。 (29 fps最佳编码结果).WMEncoder无法制作截图。 [[2]]我试过DirectX: Surface s = device.CreateOffscreenPlainSurface( Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, Format.A8R8G8B8, Pool.SystemMemory); device.GetFrontBufferData(0, s); SurfaceLoader.Save(“c:\\Screenshot”+i.ToString()+”.bmp”, ImageFileFormat.Bmp, s); 这就像gdi ..very slow ….它只适用于DirectX 1.0,因为在DirectX 2.0中不存在SurfaceLoader 我在一些post中读到的另一种方式是使用: s = device.GetBackBuffer(0, 0, Microsoft.DirectX.Direct3D.BackBufferType.Mono); ,但这只是截图到了当前的窗口。 [[3]]我曾尝试使用Taksi(在sourceforge.net上)…但我不知道如何在c#中使用它并让它工作。 请帮帮我…

C#:从Windows服务捕获屏幕

我必须每隔一秒捕获一次桌面的截图。 在Winform应用程序中运行正常。 但在将代码移动到Windows服务后,它不会捕获屏幕截图。 知道为什么不这样做吗? 这是代码 public partial class ScreenCaptureService : ServiceBase { System.Timers.Timer timer = new System.Timers.Timer(); public ScreenCaptureService() { InitializeComponent(); this.timer.Interval = 1000; this.timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); } void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { CaptureScreen(); } protected override void OnStart(string[] args) { if (!EventLog.SourceExists(this.ServiceName, Environment.MachineName)) { EventLog.CreateEventSource( new EventSourceCreationData( this.ServiceName, Environment.MachineName ) ); } […]