I\'m getting this error
The type initializer for \'Emgu.CV.CvInvoke\' threw an exception.
when I try to use Emgu CV. I\'ve tried
you should add dependency dll into project and change 'copy to output directory' property to 'copy always' (add -> existing item) from Emgu\emgucv-windows-universal-cuda 2.9.0.1922\bin\x86
in my project add : opencv_core290.dll , opencv_highgui290.dll , opencv_ffmpeg290.dll , opencv_imageproc290.dll and cudart32_55.dll
First you have to add three libraries to your project. opencv_core290.dll,opencv_highgui290.dll,opencv_imgproc290.dll. In here 290 refers that your opencv version. After that change in their property "Do not copy" to "copy always". than save your project. After that go to following location. If your machine is 64 bit than go to following folder "C:\Emgu\emgucv-windows-universal-cuda 2.9.0.1922\bin\x64" or if your using 32 bit os than go to "C:\Emgu\emgucv-windows-universal-cuda 2.9.0.1922\bin\x86" and copy all the dlls in that folder and paste that into your Your Project/bin/debug/ folder. than rebuild your project. Than it will works fine.
Best of luck!!!!
Installing this nuget: https://www.nuget.org/packages/Emgu.CV.runtime.windows/ solved my problem, looks like the manual dll copying was resolved by this package.
If it doesn't work on Windows Server you have to enable UI Desktop Experience.
you can view the post
It's probably failing to load the unmanaged DLL dependencies. A couple of suggestoins:
I had the same problem. My inner exception was "Unable to load DLL 'opencv_core290'".
You need to copy x86 and x64 folders from "yourEmguFolder/bin" to your project's output(bin) directory. Then build project again and run.
According to emgu wiki