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! I am trying to simply create a Mat but to no avail:
using OpenCvSharp;
using OpenCvSharp.CPlusPlus;
using MyCVSharp;
using System.Diagnostics;
using System.Collections;
class MainClass
{
static void Main()
{
Mat test3 = new Mat( new Size( 100, 100 ), MatType.CV_8UC1 ); // ERROR
Mat test2 = new Mat( "f1.png", LoadMode.Color ); // ERROR
CvMat test = new CvMat( "f1.png", LoadMode.Color ); //; THIS WORKS
The error is:
An unhandled exception of type 'System.TypeInitializationException' occurred in MyCVSharpTEST.exe
Additional information: The type initializer for 'OpenCvSharp.CPlusPlus.Mat' threw an exception.
Lots of dlls are deployed alongside my project. OpenCvSharp.CPlusPlus.dll and OpenCvSharp.dll are deployed in the same folder next to MyCVSharpTEST.exe, while a dll folder is created with x86 and x64 subfolders containing another 22 related dlls, each.
I have even tried creating a Mat from an already created CvMat but still, same error.
Edit: Error shown from try-catch block:
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
Since the problem now seems dll-related, I decided to write an all-new question about it.