Question

I am trying to use the Capture class from EmguCV on Unity Pro but everytime I call its constructor, I have the following error:

DllNotFoundException: opencv_core249 Emgu.CV.CvInvoke..cctor () Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Emgu.CV.CvInvoke Emgu.CV.Capture..ctor (Int32 camIndex)

I've read that to solve the problem on Visual Studio for example, you just have to copy and paste the opencv_coreXXX and opencv_highguiXXX to the output folder but this solution doesn't seem to work with Unity.

The problem is that Unity is searching in the right folder (the output folder where I put all the EmguCV dll's) but doesn't seem to find the dll.

To install EmguCV in Unity, I've just followed the steps described by this guy on the following link: http://forum.unity3d.com/threads/182600-OpenCV-(EMGUCV-wrapper)-integration-in-Unity

Was it helpful?

Solution

If you use a dll as a plugin it should be in the Assets/Plugins-folder. If that plugin needs other dll's they should be in the root of the project folder (or in the Editor-folder of Unity installation folder). If the application is built, naturally the dll's should be made available, for example adding them to the same folder as the executable.

You can try to track down the exception with Dependency Walker.

In addition I have encountered similar problems in Windows 8 when highgui.dll was needed by the plugin. Once removed, no exceptions (I never really found out what the problems was).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top