opencvsharp osx compilation error

asked 2014-11-15 15:59:12 -0600

pavan gravatar image

HI I would like to use opencv in a unity app on mac OS X yosemite.

I was able to run a sample app from sample

But it has an old version of opencv so I would like to compile it myself.

I grabbed opencvsharp from here and included the opencvsharp.dll in my unity project and installed opencv on my machine.

If I run the sample I get the following error :

DllNotFoundException: /opt/local/lib/libopencv_core.dylib
OpenCvSharp.Utilities.PInvokeHelper.TryPInvoke ()
Rethrow as OpenCvSharpException: /opt/local/lib/libopencv_core.dylib
*** An exception has occurred because of P/Invoke. ***
Please check the following:
(1) OpenCV's DLL files exist in the same directory as the executable file.
(2) Visual C++ Redistributable Package has been installed.
(3) The target platform(x86/x64) of OpenCV's DLL files and OpenCvSharp is the same as your project's.
System.DllNotFoundException: /opt/local/lib/libopencv_core.dylib
OpenCvSharp.Utilities.PInvokeHelper.TryPInvoke ()
OpenCvSharp.Utilities.PInvokeHelper.DllImportError (System.Exception ex)
OpenCvSharp.Utilities.PInvokeHelper.TryPInvoke ()
OpenCvSharp.NativeMethods..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for OpenCvSharp.NativeMethods
OpenCvSharp.CvCapture..ctor (Int32 index)
OpenCvSharp.Cv.CreateCameraCapture (Int32 index)
CaptureScript.Start () (at Assets/Scripts/CaptureScript.cs:16)

I have the dylib in the specified location. Could anyone tell me how to fix this?

edit retag flag offensive close merge delete