C# OpenCV 的 .Net (dotNet) 包装器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/85569/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
.Net (dotNet) wrappers for OpenCV?
提问by Kris Erickson
I've seen there are a few of them. opencvdotnet, SharperCV, EmguCV, One on Code Project.
我看到有几个。 opencvdotnet、SharperCV、EmguCV、代码项目之一。
Does anyone have any experience with any of these? I played around with the one on Code Project for a bit, but as soon as I tried to do anything complicated I got some nasty uncatchable exceptions (i.e. Msgbox exceptions). Cross platform (supports Mono) would be best.
有没有人有任何这些方面的经验?我在 Code Project 上玩了一会儿,但是一旦我尝试做任何复杂的事情,我就会遇到一些令人讨厌的无法捕获的异常(即 Msgbox 异常)。最好是跨平台(支持 Mono)。
采纳答案by friism
I started out with opencvdotnet but it's not really actively developed any more. Further, support for the feature I needed (facedetection) was patchy. I'm using EmguCVnow: It wraps a much greater part of the API and the guy behind it is very responsive to suggestions and requests. The code is a joy to look at and is known to work on Mono.
我从 opencvdotnet 开始,但它并没有真正积极开发。此外,对我需要的功能(人脸检测)的支持是不完整的。我现在正在使用EmguCV:它包含了 API 的大部分内容,并且它背后的人对建议和请求非常敏感。代码看起来很有趣,并且可以在 Mono 上运行。
I've wrote up a quick getting-started guideon my blog.
我在我的博客上写了一个快速入门指南。
回答by Silver Dragon
SharperCV was our tool of choice, and it doesn't let us down, for our robotics project. Even though it is currently marked as abandoned, the code is in really good shape, requires only minor tweaking to customize it for your need. No msgboxes, and actually very sane exception handling.
SharperCV 是我们选择的工具,它没有让我们失望,用于我们的机器人项目。尽管它目前被标记为废弃,但代码的状态非常好,只需稍作调整即可根据您的需要对其进行自定义。没有 msgboxes,实际上非常理智的异常处理。
Not cross-platform, though, due to the interoperability layer.
但是,由于互操作性层,不是跨平台的。
回答by tidyup
We use OpenCVSharpthe google code website is in Japanese but it uses the latest OpenCV builds and impliments IDisposable throughout. It seems to provide more functioanlity than any of the others we have seen to date and is still active. It has quite extensive example programs as well.
我们使用OpenCVSharp,谷歌代码网站是日文,但它使用最新的 OpenCV 构建和实现 IDisposable。它似乎提供了比我们迄今为止看到的任何其他产品更多的功能,并且仍然处于活动状态。它也有相当广泛的示例程序。
回答by Jean-Fran?ois C?té
I know this question has been answered for a long time, but I would like to add that there is a very good wrapper here. This is the new version of the openCV wrapper that you tried on code project. I've tried it for a couple of days and everything works perfect. Also, I got it working in minutes.
我知道这个问题已经回答了很长一段时间,但我想补充一点,有一个很好的包装这里。这是您在代码项目上尝试过的 openCV 包装器的新版本。我已经尝试了几天,一切正常。另外,我在几分钟内就让它工作了。
I don't know for the compatibility with mono but under Visual Studio 2010, it works like a charm and saved me ton's of time and money (my project is commercial and most of the library are open source with licence that doesn't allow commercial utilisation unless publishing the code)
我不知道与单声道的兼容性,但在 Visual Studio 2010 下,它就像一个魅力一样,为我节省了大量的时间和金钱(我的项目是商业的,大多数库都是开源的,许可证不允许商业除非发布代码)
回答by Paul Williams
I think it's important to note that the original question was asked in 2008, and OpenCV 2.0 was released in 2009. The version 2.0 release introduced a C++ wrapper which is significantly easier to work with than the older C interface that the OP was confronted with. For my .NET project, I'm leaving all the graphic manipulation in native C++.
我认为重要的是要注意最初的问题是在2008年提出的,而 OpenCV 2.0 是在2009年发布的。2.0 版引入了一个 C++ 包装器,它比 OP 面临的旧 C 接口更容易使用。对于我的 .NET 项目,我将所有图形操作都保留在本机 C++ 中。
Try this:create a C++/CLR DLL project which links to the OpenCV libraries. The OpenCV manual describes how to do this for a Windows C++ EXE, the same steps also work for a C++/CLR DLL. Then of course the DLL exports methods which are callable from a .NET EXE.
试试这个:创建一个链接到 OpenCV 库的 C++/CLR DLL 项目。OpenCV 手册描述了如何为 Windows C++ EXE 执行此操作,相同的步骤也适用于 C++/CLR DLL。然后当然 DLL 导出可从 .NET EXE 调用的方法。
To test it, you should be able to incorporate any of the OpenCV samples into your DLL with a little tweaking. (Add the .CPP file to your project, convert the main() function to a class member, etc. - you know the drill...) A good test candidate might be the "mat_mask_operations" sample.
要对其进行测试,您应该能够通过稍微调整将任何 OpenCV 示例合并到您的 DLL 中。(将 .CPP 文件添加到您的项目中,将 main() 函数转换为类成员等 - 您知道练习...)一个好的测试候选对象可能是“mat_mask_operations”示例。
回答by mrgloom
I think best wrapper is opencvsharp http://code.google.com/p/opencvsharp/
我认为最好的包装器是 opencvsharp http://code.google.com/p/opencvsharp/
回答by Tony
I created a NuGet Package to make easy to start with OpenCv in C#, using EmguCV.
我创建了一个 NuGet 包,以便使用 EmguCV 在 C# 中轻松启动 OpenCv。
Check it out! In Visual Studio search and add the myEmguCV.NetNuGet package.
一探究竟!在 Visual Studio 中搜索并添加myEmguCV.NetNuGet 包。
回答by VoteCoffee
OpenCV.NET NuGet was last updated on 12/30/2016 and BitBucket was updated as recently as 2017-03-31, so it appears to be poorly supported. Emgu CV has been updated as recently as 2019-10-06 at the time of this edit and appears to be the better choice going forward.
OpenCV.NET NuGet 上次更新是在 2016 年 12 月 30 日,而 BitBucket 是在 2017 年 3 月 31 日更新的,因此它的支持似乎很差。Emgu CV 在本次编辑时已于 2019 年 10 月 6 日更新,似乎是未来更好的选择。
OpenCV.NET is available from NuGet.
OpenCV.NET 可从 NuGet 获得。
https://bitbucket.org/horizongir/opencv.net
https://bitbucket.org/horizongir/opencv.net
https://www.nuget.org/packages/OpenCV.Net
https://www.nuget.org/packages/OpenCV.Net
Here's a list of features from the project site:
以下是项目站点的功能列表:
OpenCV.NET is a .NET interface for the popular OpenCV computer vision and image processing library. These bindings were developed over the course of a year and include many features that have been missing from other attempts, namely:
- Cross-platform Mono compatibility (only P/Invoke is used)
- Very close to 100% support of the latest C API (including undocumented functions)
- Full documentation/intellisense for all supported methods, classes and enum members (arduously mined from many different sources)
- Support for exceptions
- Garbage-collector friendly:
- GC is aware of the actual memory used by matrices and images
- Pointers are guaranteed to survive function calls even if concurrent garbage collection happens
- Object model following C++ API as much as possible (towards future increased support of C++ API)
- BSD-style license (MIT)
OpenCV.NET 是流行的 OpenCV 计算机视觉和图像处理库的 .NET 接口。这些绑定是在一年内开发的,包括许多其他尝试中缺少的功能,即:
- 跨平台 Mono 兼容性(仅使用 P/Invoke)
- 非常接近 100% 支持最新的 C API(包括未记录的函数)
- 所有支持的方法、类和枚举成员的完整文档/智能感知(从许多不同的来源中艰难挖掘)
- 支持异常
- 垃圾收集器友好:
- GC 知道矩阵和图像使用的实际内存
- 即使发生并发垃圾收集,指针也能保证在函数调用中存活
- 对象模型尽可能遵循 C++ API(未来增加对 C++ API 的支持)
- BSD 风格的许可证 (MIT)