Touchless Vision C# 网络摄像头包装器,如果没有安装 VS 则无法运行

发布于 2025-01-05 22:26:31 字数 518 浏览 1 评论 0原文

因此,我一直在寻找一种在 C# 应用程序中使用网络摄像头的好方法。我尝试了 ap/invoke dll,结果发现有莫名其妙且无法重现的错误。在修改了其他一些不合适或完全过时的内容后,我被提到了:

http://jakemdrew.wordpress.com/2012/01/10/controlling-your-web-camera-using-c/#comment-15

这是使用 C# 的非接触式视觉代码包装器更新为可以在 VS 2010 中工作。只要机器上安装了 VS,它就可以很好地工作。下载并在任何不支持该版本的版本上运行该版本,它将抛出一个错误,声称找不到 WebCamLib.dll 或其依赖项之一。有趣的是我已经将其集成到项目中。它工作得很好,但我希望能够在不需要额外安装程序或要求在所有东西上安装 VS 2010 的情况下分发它。这里给出了什么?

So I've been hunting around for a good way to utilize a webcam from within a C# application. I tried a p/invoke dll which turned out to be inexplicably and irreproduceably buggy. After tinkering with a few others that either weren't suitable or were utterly archaic, I was referred to this:

http://jakemdrew.wordpress.com/2012/01/10/controlling-your-web-camera-using-c/#comment-15

It's the Touchless Vision code with a C# wrapper updated to work in VS 2010. It works wonderfully...as long as VS is installed on the machine. Download and run that release build on anything that doesn't and it will throw an error claiming that it can't find WebCamLib.dll or one of its dependencies. The fun part is that I've already integrated this into the project. It works great, but I'd like to be able to distribute this without additional installers or requiring VS 2010 to be installed on everything. What gives here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故笙诉离歌 2025-01-12 22:26:31

我在多台计算机上使用 Aforge.net 库(Aforge.net),即使没有安装 VS,也没有任何问题。

但是您确定WebCamLib.dll已复制到应用程序目录中吗? Aforge.Net 还需要将一些 dll 复制到计算机上,但是如果您将 Copy Local 属性设置为 true,则它应该位于 Debug/Release 目录中,并且当您使用 Publish 发布应用程序时它也会位于该目录中。

示例:

  1. 将 Aforge.Controls.dll 添加到您的工具箱项

  2. 在设计器中将 VideoSourcePlayer 控件放入表单中

  3. 在表单类中添加 private FilterInfoCollection videoDevices;

    在表单类中

  4. 添加到表单 中初始化程序(或在您想要启动相机的函数中)

videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

    foreach (FilterInfo fi in videoDevices)
    {
      this.videoSourcePlayer1.VideoSource = new VideoCaptureDevice(MonikerString);
      this.videoSourcePlayer1.Start();
      break;
    }

现在您应该从 VideoSourcePlayer 控件中的网络摄像头获取图像。您可以使用 VideoSourcePlayer 控件的 NewFrame 事件来访问摄像机发送的每个帧并保存或更改图像。

I am using Aforge.net libraries(Aforge.net) without any problems on multiple computers even without VS installed.

But are you sure WebCamLib.dll is copied in the app directory? Aforge.Net also needs some dlls copied to computers, but if you have set Copy Local property to true, it should be inside the Debug/Release directory, also it will be in the directory when you release your app using Publish.

Sample:

  1. Add Aforge.Controls.dll to your toolbox items

  2. In designer put VideoSourcePlayer control in your form

  3. Add private FilterInfoCollection videoDevices; in form class

  4. Add into form initializer (or in function that you want to start your camera)

videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

    foreach (FilterInfo fi in videoDevices)
    {
      this.videoSourcePlayer1.VideoSource = new VideoCaptureDevice(MonikerString);
      this.videoSourcePlayer1.Start();
      break;
    }

Now you should be getting image from webcam in VideoSourcePlayer control. You can use NewFrame event of VideoSourcePlayer control to get access to each frame camera is sending and to save or change image.

农村范ル 2025-01-12 22:26:31

问题已经过去了一段时间,但是,为了解决这个问题,我会这样说:

假设您有对 dll 和文件的引用,那么它们唯一要做的就是检查 dll 依赖项, 在这种情况下
touchless 和 webcamlib dll 的程序员不太关心“版本控制”,因此,找到 x64 和 x86 的 c++ vs2012 重新发行版并安装它们,然后运行您的应用程序并继续您的项目。

well some time has passed since the question but, just for the sake of solving it I´ll say this:

Supposing that you have the references to the dlls and the files where they should be the only thing left to do is check the dll dependencies, in this case
the programmer of the touchless and webcamlib dlls didn´t care much for "versioning" so, find the c++ vs2012 redistribution for x64 and x86 and install them, then run your App and carry on with your Project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文