unable to load cvextern in a c# project

18

i'm trying to debug my program, using emgu and HaarCascade in c#. i'm getting an exception like so :

Unable to load DLL 'cvextern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

i've added the file cvextern.dll to my project and tried both "copy always" and "copy if newer" options on the properties of the file. also, the build is in platform x64.

here's partly what i wrote :

    private void Load_Click(object sender, EventArgs e)
    {
        OpenFileDialog dlg = new OpenFileDialog();
        dlg.Filter = "Photo Files (*.jpg)|*.JPG";
        dlg.CheckFileExists = true;
        if (dlg.ShowDialog() == DialogResult.OK)
        {
            Image<Bgr, Byte> My_Image = new Image<Bgr, byte>(dlg.FileName);
            HaarCascade face = new HaarCascade("haarcascade_frontalface_alt.xml");

and the exception is in the last line.

c#
dll
emgucv
asked on Stack Overflow Nov 6, 2011 by dusm • edited Mar 31, 2014 by Benjamin

7 Answers

21

The error your receiving is not solely down to cvextern this dll actually points to almost all of the other opencv dlls and all are required. With this error you will require the following dll in your project.

Note that the "220" is the version number this will change according to updates.

  • cudart64_32_16.dll
  • cufft64_32_16.dll
  • cvextern.dll
  • npp64_32_16.dll
  • opencv_calib3d220.dll
  • opencv_contrib220.dll
  • opencv_core220.dll
  • opencv_features2d220.dll
  • opencv_flann220.dll
  • opencv_gpu220.dll
  • opencv_highgui220.dll
  • opencv_imgproc220.dll
  • opencv_legacy220.dll
  • opencv_ml220.dll
  • opencv_objdetect220.dll
  • opencv_video220.dll

This error is covered along with others in my article on codeproject here.

Any other problems let me know,

Cheers,

Chris

answered on Stack Overflow Nov 7, 2011 by Chris
8

This error popped up on my side with Emgu CV 3.1 and I found for this issue a following working solution:

copy the cvextern.dll in the application directory \bin\Debug\

Hope this helps.

answered on Stack Overflow Mar 20, 2016 by gyukov • edited Mar 20, 2016 by Haroldo Gondim
1

for version 2.3 it`s list increases with opencv_ffmpeg.dll and opencv_flann231.dll.

answered on Stack Overflow Mar 27, 2012 by no.oby
1

The cvextern.dll should be in Windows\System32 for x86 and Windows\SysWOW64 for x64 it's work for me. ps: i used NuGet Package 'EmguCV' v3.1.0.1 with VS2015

answered on Stack Overflow Mar 17, 2017 by Fay├žal Kadri
1

I have solved this problem, by:

  • Right-click the project name, select Add, Select Add existing. Then select all files in the Emgu\libs\x64 folder to add to the project (allow to replace the old files if asked).
  • Then you need to select all the newly added files, right click and select Properties, In the Copy to Output section, select Copy Always.

It's done.

answered on Stack Overflow Nov 7, 2019 by Hung Mta
0

My problem for this error was that VS2015 was running the web project in 32 bit IIS Express. The fix was to ensure it was using 64 bit IIS Express

I added this code at startup to remind myself when setting up a new machine

if (IntPtr.Size != 8)
{
     throw new Exception("Change VS options to ensure 64bit IIS Express");
}
answered on Stack Overflow Nov 14, 2016 by fiat
0

in my case I had switched to a 64 target and not noticed, going to x86 made this go away

answered on Stack Overflow May 9, 2017 by twobob

User contributions licensed under CC BY-SA 3.0