I have developed a c++ program which uses OpenCV. Now i want to develop a windows form based application in C#.
As C# can only handle managed code it is nearly impossible to run OpenCV directly on C# application. I have searched for different ways to create C# application using OpenCV, one of which is EmguCV and the other method that i am much more interested in is importing the c++ .dll file in C# application and calling the unmanaged functions this way.
I started by creating simple functions in c++ and i was able to use
cout
cin
error LNK1104: cannot open file 'tbb_debug.lib'
So please Don't Suggest me to use EmguCV or any other .NET wrappers
for OpenCV.
I would explicitly export methods that wrap your entry points in a C++ header, and then use P/Invoke to reference them:
extern "C" __declspec(dllexport) BOOL DoSomething();
Then consume them in the C#:
[DllImport("MyOpenCVWrapper.dll")]
private static extern bool DoSomething();
I wouldn't try to reference the OpenCV headers.