The type initializer for 'Emgu.CV.CvInvoke' threw anexception. If you see this exception, please check the following
Have you installed MSVCRT? For Version 2.0+, the bundled OpenCV 2.0 binary is build withVisual Studio 2008, you will needs to installedMSVCRT 9.0 SP1 to resolve the dependencyissue. For Version 1.5, the bundled OpenCV pre1.1 binary is build withVisual Studio 2005, you will needs to installedMSVCRT 8.0 SP1 to resolve the dependencyissue. Have you copied the OpenCV dlls to the execution directory? Make sure the unmanaged DLLs are in the execution directory. For Emgu CV version <= 2.1, this means thefollowing dlls: cvXXX.dll, cvauxXXX.dll, cxcoreXXX.dll,highguiXXX.dll, opencv_ffmpegXXX.dll, mlXXX.dll andcvextern.dll whereXXX is the OpenCV versionnumber. For Emgu CV version >= 2.2 this means thefollowing dlls: opencv_calib3dXXX.dll, opencv_contribXXX.dll,opencv_coreXXX.dll, opencv_features2dXXX.dll,opencv_highguiXXX.dll, opencv_ imgprocXXX.dll, opencv_legacyXXX.dll,opencv_mlXXX.dll, opencv_objectdetectXXX.dll,opencv_videoXXX.dll where XXX is the OpenCVversion number. The best way to set up your project is: Copy the unmanaged DLLs to your project folder Right click on the project, click Add->ExistingItem and select all unmanaged DLLs. Add them to the project. For each of the included Dlls, left click on it, find the "Copyto Output Directory" option and select "Copy if newer" Are you running a 32-Bit OS? The windows installer is only available for 32-Bit windows. Ifyou are using a 64-bit OS, there are three possible ways to resolvethis issue:
You can download the 64bit binary only zip package fromsourceforge and add it to your project. You can also recompile OpenCV from source for 64-bit platform. See the instruction for building fromSVN Alternatively you can force your .NET application to run in32bit mode, even on a 64-bit OS. To do this, in the configurationpage of your executable project, select Platform Target as'x86'. Are you missing any dependency? Download Dependency Walker and use it to open the"cvextern.dll" file. Check if any dependency is missing.
I have checked all of above but I still got theException In this case, please try to build and run the examples. After building the examples, try to run the "Hello World"Program.
If "Hello World" runs without any problem, compare it with youproject, find the difference in configuration and fix it.
If "Hello World" get the same "The type initializer for'Emgu. CV.CvInvoke' threw an exception." message, try to find outtheInnerException and report it to the discussion forum
type initialization of emgu. CV。 cvinvoke 'put exceptions. If you see this exception, please check the following Have you installed msvcrt? Version 2+, bundled opencv 2 binary is to build Visual Studio 2008, and you will need to install edmsvcrt 9 SP1 to resolve dependencyissues. For version 1.5, bundled OpenCV pre1.1 binary build Visual Studio 2005, you will need to install edmsvcrt 8 SP1 to resolve dependencyissues. The opencv DLL execution directory you copied? Ensure that the unmanaged DLL is in the execution directory. For emgu CV version< = 2.1, which means the following DLL:cvxxx.dll,cvauxxxx.dll,cxcorexxx. DLL, highguixxx.dll, opencv_ffmpegxxx.dll, mlxxx.dll andcvextern.dll wherexxx are the versionnumbers of opencv. For emgu CV version> = 2.2 This means that the following DLL:opencv_calib3dxxx.dll, opencv_contribxxx. DLL,opencv_corexxx.dll,opencv_features2dxxx。 DLL,opencv_highguixxx.dll,opencv_imgprocxxx.dll,opencv_legacyxxx。 DLL,opencv_mlxxx.dll,opencv_objectdetectxxx。 DLL, opencv_videoxxx.dll XXX is the opencvversion number. The best way to build your project is: Unmanaged DLL copied to your project folder Right-click on the project and click Add-> existingitem to select all unmanaged DLLs. Add them to the project. For each DLL it contains, left-click on it, find the "Copy & Output Directory" option, select "Copy if updated" Do you run a 32-bit operating system? Windows Installer can only provide 32-bit Windows. If you're using a 64-bit operating system, there are three possible ways to solve this problem: You can download the 64-bit binary only zip package fromsourceforge and add it to your project. You can also compile OpenCV sources from 64-bit platforms. See the building fromsvn directive Or you can force yours. .NET applications run in 32bit mode, even on 64-bit operating systems. To do this, on the configuration page of your execution project, select the platform target as'x86". Are you missing any dependencies? Download Dependent Walker and use it to open the "cvextern DLL file." ”。 Check if any dependencies are missing. I checked all of the above but I still have exceptions In this case, try building and running an instance. After building the instance, try running the Hello World program. If Hello World runs without any problems, it compares with youproject, finds structural differences and solves it. If "hello world" gets the same "type initial value setter for'emgu". CV。 cvinvoke" throws an exception. message, trying to find outtheinnerexception to the forum
|