I have installed the latest OpenCVSharp 2 (2.4.10.201...) with the NuGet manager in my project. Everything concerning OpenCVSharp.CvMat is working OK (loading, manipulation etc) so I am sure the installation is correct.
However I cannot use OpenCVSharp.CPlusPlus at all! The problem is that it doesn't load OpenCvSharpExtern.dll.
Error shown from try-catch block:
try
{
Mat mat = new Mat();
} catch (Exception err)
{
Console.WriteLine( err );
}
System.TypeInitializationException: The type initializer for 'OpenCvSharp.CPlusPlus.Mat' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at OpenCvSharp.CPlusPlus.NativeMethods.core_Mat_sizeof()
at OpenCvSharp.CPlusPlus.Mat..cctor()
--- End of inner exception stack trace ---
at OpenCvSharp.CPlusPlus.Mat..ctor()
at MainClass.Main() in C:\Users\kotsias\Documents\Visual Studio 2015\Projects\MyCVSharp\ConsoleApplication1\Test.cs:line 14
The OpenCvSharpExtern.dll IS deployed alongside my .exe inside the following subfolders:
..\dll\x86
&
..\dll\x64
If I manually copy the x64 .dll in the same folder as my .exe, I still get the same error above. If I copy the x86 .dll, I get a different error:
System.TypeInitializationException: The type initializer for 'OpenCvSharp.CPlusPlus.Mat' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at OpenCvSharp.CPlusPlus.NativeMethods.core_Mat_sizeof()
at OpenCvSharp.CPlusPlus.Mat..cctor()
--- End of inner exception stack trace ---
at OpenCvSharp.CPlusPlus.Mat..ctor()
at MainClass.Main() in C:\Users\kotsias\Documents\Visual Studio 2015\Projects\MyCVSharp\ConsoleApplication1\Test.cs:line 14
It is not enough installing the "OpencvSharp{version} nuget" package. You also have to install the "OpencvSharp{version}.runtime.{operating_system}" package.
For example, in my case I had to install the following Nuget pacages:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With