I'm using .net framework 4.8 in my c# winforms project. Platform target Any CPU
In the project from the Manage NuGet Packages... I searched for Emgu.CV then in the project I added both using:
using Emgu.CV;
using Emgu.CV.Structure;
then inside a method I'm calling from a button call event:
private void Test(string videoPath)
{
// Load the video file
VideoCapture videoCapture = new VideoCapture(videoPath);
}
and
private void btnOpenVideo_Click(object sender, EventArgs e)
{
Test(@"C:\Users\something\Downloads\test.mp4");
}
I can play the video file from the hard drive with any player.
But when clicking the button, it's throwing an exception on the line:
VideoCapture videoCapture = new VideoCapture(videoPath);
System.TypeInitializationException: 'The type initializer for 'Emgu.CV.CvInvoke' threw an exception.'
and
Inner Exception DllNotFoundException: Unable to load DLL 'cvextern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
No clue how to fix it. I tried to google, but none of the answers worked so far.