Integrate OpenCV (Emgu or OpenCvSharp) how to?

Hi everyone,

I’ve saw videos like this: Unity + OpenCvSharp - YouTube
which seems a successfully integrated OpenCvSharp into Unity.

I tried to contact this ‘aiminable’ but he’s not giving back any response.

Did anyone here integrated OpenCV to Unity before? Could you give me some information on how to do that? I keep getting errors when I try to make OpenCvSharp or Emgu working.

Any help would be appreciated. Thanks.

As I said in the answer, you need to delete System.Drawing in all OpenCvSharp's source code and recompile it.

–

I am trying to get opencvsharp working as well, but I want to get this working with IOS and Android and I am not sure if this is possible. I am also planing to use a mac for developing but that should not be a problem I think. Any hints would be much appreciated.

–

4 Answers

4

I ran across quite a few questions like this while searching around today to get OpenCV up and running, and after an embarassing length of time to figure it out, just figured I should follow up here:

The Internal Compiler/System.Drawing error that people see: in your project settings / Player / Api compatibility level, set your to .NET 2.0 instead of the Subset!

As to the other common error people are seeing, the OpenCVSharp popup for “DllNotFoundException: opencv_core220.dll”
when using the OpenCvSharp from HERE the current build on there depends on OpenCV 2.4, you then need to download OpenCV 2.4 from HERE then take the .dll’s you plan to use and place them in the same directory as your Exe…

EX: if you want to play in the editor, you can place them in the Program files/Unity/Editor/ dir… if you want to play with a standalone, place them in the same dir as your standalone .exe file.

after that, fun with programming!

PS: I should also add that I ended up having to compile my own OpenCV before it would work, following the directions in the openCV help, cmake, visual studio, etc.

Well I am stuck in trying to build the opencvsharp on mac. It cant find OpenCV and I dont know how to configure the FindOpenCV.cmake. I guess you were building on windows?

–

Also stuck. I compiled the OpenCVSharp.dll (v.245) on OSX but have no idea how to compile the opencv_coreXXX.dll from the files downloaded at opencv.org

–

Does anyone have a Unity plugin or sample program that we could just download?

I actually figured it out months ago, but forget to post an answer here!

I finally made contact with animinable. The thing is OpenCvSharp need to be recompiled with System.Drawings deleted (unity do not support that). Then put the dlls in and it will work.

Thanks to animinable!

I managed to get rid of the System.Drawings error by recompiling the OpenCvSharp.dll but now I get this: 'DllNotFoundException: opencv_core240'. Whats next?

–

Simply adding ' opencv_core240.dll' to the Plugins directory does not do the trick.

–

I've got the same problem with 'DllNotFoundException: opencv_core220.dll' I've also added it to the Plugins directory, the question is now, if there is a problem that it is a C++ library while the EMGU dlls are C# (the should work similar as the OpenCvSharp dlls)

–

Ping. Still stuck. Did anyone make this work on OSX?

–

Hi,

I think the best approach is to get OpenCV plus Unity from Asset Store.

94975-forum-small.png