网络摄像头、C# 和可靠的包装器
我迫切需要替换 C# 应用程序中使用的包装器。基本上,我们需要做的是将网络摄像头附加到两个图片框之一。这将用于通过按下按钮来拍摄静态图像,这可能会分离相机源并将静态图像附加到该图片框,然后稍后重新附加相机源。我们之前找到了一些免费代码,可以与 CaptureDevice.cs 文件和 Pinvoke.dll 结合使用,将其绑定到 avicap32.dll 中。不幸的是,这似乎存在随机、间歇性错误,无法可靠地重现。实在是太片状了。在某个随机时刻,其中一个图片框可能会变黑,并且在拍摄照片之前不会显示提要,此时正确的图片将附加到图片框。然后,即使只连接了一个网络摄像头,它也会不断提示选择网络摄像头,否则它不会这样做。
坦率地说,我对 Microsoft 没有在 .NET 中包含任何内容来覆盖网络摄像头视频源感到惊讶和沮丧。我正在寻找可靠且相对简单的方法来取代这个有缺陷的网络摄像头系统。
I'm in dire need of a replacement for a wrapper being used in a C# application. Basically, what we need to do is attach a webcam feed to one of two picture boxes. This will be used to take still images at the push of a button, which may detach the camera feed and attach the still image to that picture box, then reattach the camera feed later. We had previously found some free code to utilize with a CaptureDevice.cs file and Pinvoke.dll to tie it into avicap32.dll. Unfortunately, this seems to have random, intermittent errors that cannot be reliably reproduced. It's just too flaky. At some random point, one of those picture boxes may go black and won't show the feed until the picture is taken, at which point the proper picture is attached to the picture box. Then, even if there's only one webcam attached, it'll keep prompting for the webcam to be selected, something it wouldn't do otherwise.
Quite frankly, I'm surprised and dismayed that Microsoft hasn't included anything in .NET to cover webcam video feeds. I'm looking for something reliable and relatively simple to implement to replace this buggy webcam system.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我可以建议
http://www.emgu.com/wiki/index.php/Main_Page< /a>
我已经在许多 C++ 库中使用了 OpenCV,并且从我尝试过的其他东西来看,它似乎非常适合网络摄像头。 Emgu 只是 OpenCV 的 C# 包装器。
这是一个可供尝试的示例项目。它非常基本且简单,但应该可以立即使用。
http://dl.dropbox.com/u/18919663/vs%20samples /OpenCVCSharpTest.zip(刚刚上传)
示例:
May I suggest
http://www.emgu.com/wiki/index.php/Main_Page
I have used OpenCV in many C++ libraries and it seems to work very well for webcams from other things I've tried. Emgu is just a C# wrapper for OpenCV.
Here is a sample project to try it out on. It's very basic and simple, but should work right away.
http://dl.dropbox.com/u/18919663/vs%20samples/OpenCVCSharpTest.zip (just uploaded)
Sample:
是时候使用 MediaCapture 对象了。将此示例用于 MS Windows 10 https://github。 com/Microsoft/Windows-universal-samples/tree/master/Samples/CameraStarterKit/
并阅读这篇文章http://www.codepool.biz/csharp-camera-api-video-框架.html
It is time to use
MediaCapture
object. Use this sample for MS Windows 10 https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/CameraStarterKit/And read this article as well http://www.codepool.biz/csharp-camera-api-video-frame.html
尝试 DirectShow.net - 它是一个免费的包装库,用于从 .NET 访问 DirectShow 功能:
http://directshownet.sourceforge.net
其代码示例还包含一个用于从网络摄像头捕获视频的示例应用程序:
http://sourceforge.net/projects/directshownet/files/DirectShowSamples/
Try DirectShow.net- it's a free wrapper library to access DirectShow functionality from .NET:
http://directshownet.sourceforge.net
Its code samples contain a sample app for capturing video from webcams, too:
http://sourceforge.net/projects/directshownet/files/DirectShowSamples/