- Home /
OpenCV integration
Hello Developers!
I am a unity developer trying my hands on opencv for the first time. My initial goal is to run the camera and detect blobs via opencv in unity3d. I am new to OpenCV and am trying to integrate it in Unity3D (on Windows 8 with Unity 4.3.2 and on a mac with Unity 4.2.1f). I followed this thread. But I am getting the following error as soon as I add a new C# script. And the moment I delete this script, the error goes (this script is Unity generated C# script).
Internal compiler error. See the console log for more information. output was: Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool) at System.Reflection.Assembly.GetTypes () [0x00000] in :0 at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0 at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0 at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0 at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0 at Mono.CSharp.Driver.Compile () [0x00000] in :0 at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0
I couldn't find much about Unity and OpenCV integration. It would be great if you could help me out with this error and point me to a recent tutorial to learn more.
Thanks in advance!
Answer by avr · Jun 25, 2014 at 12:53 AM
Could you describe in more detail how you attempted to include OpenCV in UNity? What are your target platforms?
Did you have a look at EMguCV, which is a C# wrapper for Opencv?
Problems you will face when using EmguCV with UNity will be
- its dependence on System.Drawing, which, e.g., maps OpenCv datastructures, but is native win 
- requires NET 3.5, whereas Unity supports only Net 2.0 and Net 2.0 subset (which appears to be a Unity specific thing) 
I guess what needs to be done is:
- Remove from EmguCV all calls which require NET 3.5 
- Replace all calls to methods in System.Drawing with calls to win independend implementations of, e.g. OpenCv datastructure (Point, Rect, ....) 
Also have a look at this diagram: http://www.emgu.com/wiki/index.php/Main\_Page#Architecture_Overview
Answer by benbonjour · May 19, 2016 at 06:13 AM
Hi guys,
a colleague of mine made this :
https://github.com/Alex0216/UnityOpenCVExample/wiki
which was very useful in our project.
Best of luck !
Your answer
 
 
             Follow this Question
Related Questions
Emgu/OpenCV with Unity Free 1 Answer
EmguCv inside Unity 2 Answers
opencv (emgucv) not working in unity in osx? 1 Answer
Plugins on OSX (OpenCV and EmguCV) 2 Answers
EmguCV CalibrateCamera - EntryPointNotFoundException 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                