0

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

Bart
  • 19,692
  • 7
  • 68
  • 77
Aleph0
  • 470
  • 2
  • 10
  • 27
  • Keep in mind that Unity will give the exact same error if it is in fact another DLL that is missing. That is, one that the DLL it's trying to load is using. So make sure all the dependencies are available as well. If they aren't, it will report the DLL as not found, even though it is present. – Bart Mar 12 '14 at 15:40

1 Answers1

1

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

jparimaa
  • 1,964
  • 15
  • 19
  • 1
    I copied and pasted the opencv_coreXXX and opencv_highguiXXX dll files in the Editor-folder and the error doesn't appear anymore. Thank you ! – Aleph0 Mar 13 '14 at 14:43