从网络摄像头捕获静止图像(DirectSHowLib,VB.NET)
我很as愧,但无论如何我都会问:这是从具有默认大小和色彩深度的网络摄像机拍摄照片的最直接方法吗?
I'm ashamed, but I'll ask anyway: which is the most straightforward way to take a picture from a webcam with its default size and color-depth?
我开始玩 DirectShowLib ,但我一无所知...谁能说服我
I started playing with DirectShowLib but I'm clueless... Can anyone guive me a guidance?
Imports DirectShowLib
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
PictureBox1.Image = Nothing
Dim Cam As DsDevice = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice).FirstOrDefault
If Cam IsNot Nothing Then
Stop
' ... what now?
End If
End Sub
End Class
DirectShowLib的样本 DxSnap,DxWebCam(C#)显示了如何从网络摄像头捕获。那里还有VB.NET DxLogoVB,它做的事情与众不同,但是如果您还寻找一些DriectShow.NET + VB.NET示例代码,则仍然很好。
DirectShowLib's samples DxSnap, DxWebCam (C#) show how to capture from a webcam. There is also VB.NET DxLogoVB there, it does a different thing but is still good if you also look for some DriectShow.NET + VB.NET sample code.
DxWebCam :
DxWebCam:
一个穷人的网络摄像头程序。该应用程序作为Win32服务运行。
它获取捕获图的输出,将其转换为JPEG
文件流,然后通过TCP / IP到客户端应用程序。
A poor man's web cam program. This application runs as a Win32 Service.
It takes the output of a capture graph, turns it into a stream of JPEG files, and sends it thru TCP/IP to a client application.
DxSnap:
使用DirectShow从捕获的
设备的Still针中拍摄快照。请注意,MS鼓励您为此使用WIA,但是如果要在
中使用使用DirectShow和C#,方法如下。
Use DirectShow to take snapshots from the Still pin of a capture device. Note the MS encourages you to use WIA for this, but if you want to do in with DirectShow and C#, here's how.
请注意,此示例仅适用于将未压缩的
视频输出为RBG24的设备。这将包括大多数网络摄像头,但可能包括零个电视调谐器。
Note that this sample will only work with devices that output uncompressed video as RBG24. This will include most webcams, but probably zero tv tuners.