75

I've seen there are a few of them. opencvdotnet, SharperCV, EmguCV, One on Code Project.

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.

Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
Kris Erickson
  • 33,454
  • 26
  • 120
  • 175

8 Answers8

71

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 EmguCV now: 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.

I've wrote up a quick getting-started guide on my blog.

friism
  • 19,068
  • 5
  • 80
  • 116
  • 8
    Beware, EmguCV uses a dual GPL3/Commercial license whereas OpenCV uses a BSD license. Note that OpenCVSharp uses an LGPL license. OpenCVSharp is actively developed as of April, 2014. – Kaganar Apr 17 '14 at 18:24
  • 1
    If you have plans to ship your project as a real, maintainable product, then be wary of OpenCVSharp. I played with it for a few weeks - it works fine but the docs and examples are sparse. I like its BSD license and the dev is good/active, but he needs a proper team. EmguCV's [documentation](http://www.emgu.com/wiki/files/3.0.0/document/html/2ec33afb-1d2b-cac1-ea60-0b4775e4574c.htm), [working examples](http://sourceforge.net/p/emgucv/code/ci/master/tree/Emgu.CV.Example/), and [community support](http://stackoverflow.com/questions/tagged/emgucv?sort=frequent) are vastly superior. – kdbanman Jul 08 '15 at 18:02
  • EmguCV depends on an old versions of the system libraries (including GTK+ 2). It might be a problem if you are planning to use it on any unsupported system e.g. Arch Linux. – Dmitry Fedorkov Oct 20 '16 at 04:36
  • 1
    Link to getting started guide is timing out for me – Andy P Mar 23 '17 at 12:58
  • Has your blog been relocated, @friism ? http://friism.com/ is dead. – Fetchez la vache Mar 24 '17 at 11:30
28

NuGetMustHaves has a good summary of packages on NuGet with their build dates and OpenCV revs.

As of 8/8/2023:

  • EmguCV is updated for OpenCV v4.7.0.5276
  • OpenCvSharp is updated for OpenCV v4.8.0.20230708

EmguCV and OpenCvSharp are the 2 packages with recent builds and appear to be the better choices going forward.

Beware, EmguCV uses a dual GPL3/Commercial license (source) whereas OpenCVSharp uses the BSD 3-Clause License. In other words, OpenCVSharp is free for commercial use but EmguCV is not. EmguCV has superior documentation/examples/support and a bigger development team behind it, though, making the license worthwhile in many cases.

It's worth considering what your future use cases are. If you're just looking to get running quickly using a managed language, the wrappers are fine. I started off that way. But as I got into more serious applications, I've found building a python/C++ application has better performance and more potential for reuse of code across platforms.

VoteCoffee
  • 4,692
  • 1
  • 41
  • 44
22

We use OpenCVSharp the 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.

tidyup
  • 221
  • 2
  • 2
19

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++.

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.

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.

Paul Williams
  • 3,099
  • 38
  • 34
  • 4
    I really like your idea. Removing a layer of maintenance and complexity by ignoring a third party wrapper sounds great. Can you link/provide a minimal example of the modified source? – kdbanman Jul 08 '15 at 18:06
2

I think best wrapper is opencvsharp http://code.google.com/p/opencvsharp/

mrgloom
  • 20,061
  • 36
  • 171
  • 301
2

I created a NuGet Package to make easy to start with OpenCv in C#, using EmguCV.

Check it out! In Visual Studio search and add the myEmguCV.Net NuGet package.

https://www.nuget.org/packages/myEmguCV.Net

Tony
  • 16,527
  • 15
  • 80
  • 134
0

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.

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)

Jean-François Côté
  • 4,200
  • 11
  • 52
  • 88
0

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.

Not cross-platform, though, due to the interoperability layer.

Silver Dragon
  • 5,480
  • 6
  • 41
  • 73