UnityMainThreadDispatcher.cs
is from https://github.com/PimDeWitte/UnityMainThreadDispatcher
For this script to work with Unity, you must compile a few dependencies. Don't be afraid, it's not that complicated!
Preconditions:
- Microsoft Visual Studio
- Microsoft VC++ distributables
- Emgu CV use WCF(Windows Communication Foundation), therefore requires .Net 3.0
-
You will need EmguCV, a .net wrapper for OpenCV
- Download the newest release of EmguCV from https://sourceforge.net/projects/emgucv/
- Install EmguCV
- Open the root of EmguCV in your explorer and go to
/EmguCV/Solution/<platform>/
- Open the solution
Emgu.CV.sln
inside the folder (You will need Microsoft Visual Studio, as well as the newest VC++ distributables for that) - If your preconditions are all set, you should now be able to build the whole project by right clicking on the project in the solution and selecting the option
Build Solution
. This can also be done by selectingBuild > Build Solution
-
Now you have to copy the compiled dependencies to your Unity project
- Create a new folder
Plugins
inside your Unity projectAssets
folder - Go to
/EmguCV/libs
and copy all the dlls (with the already given structure), paste these dlls with the subfolders to your createdPlugins
directory.Plugins
should now look like this: Plugins after EmguCV dlls
- Create a new folder
-
For the classifiers, we also need the
Rectangle
class fromSystem.Drawing
. SinceSystem.Drawing
is not included in Unity by default (no support), we have to include theSystem.Drawing
dll.- Just navigate to your Unity installation directory and go to
Unity/Editor/Data/Mono/lib/mono/2.0
- Copy the file
System.Drawing.dll
- Paste it to your
Plugins
folder, just like before.Plugins
should now look like this: Plugins after System Drawing dlls
- Just navigate to your Unity installation directory and go to