What Can I do if "The type initializer for 'Emgu.CV.CvInvoke' threw an exception"?
2012-03-23 00:07
627 查看
fromhttp://www.emgu.com/wiki/index.php/Download_And_Installation#Building_the_Examples
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
Make sure the unmanaged DLLs are in the execution directory.
For Emgu CV version <= 2.1, this means thefollowing dlls:
For Emgu CV version >= 2.2 this means thefollowing dlls:
where
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"
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'.
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
The type initializer for 'Emgu.CV.CvInvoke' threw anexception.
If you see this exception, please check the followingHave you installed MSVCRT?
For Version 2.0+, the bundled OpenCV 2.0 binary is build withVisual Studio 2008, you will needs to installedMSVCRT9.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.dllwhere
XXXis 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
XXXis 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 tobuild 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
相关文章推荐
- What Can I do if "The type initializer for 'Emgu.CV.CvInvoke' threw an exception"?
- C#初始化数据库错误提示:The type initializer for 'ASSET.DBHelper' threw an exception
- NUnit Error: The Type Initializer for … Threw an Exception (And app.config)
- 报错信息: "System.Web.UI.BaseParser" The type initializer threw an exception.
- The type initializer for 'TestStatic.StaticClass' threw an exception.
- Error creating control: The type initializer for 'Microsoft.Web.Design.ExtenderInformationServiceProvider' threw an exception
- The type initializer for System.Data.SqlClient.SqlConnection threw an exception
- The document type declaration for root element type "config" must end with '>'.错误
- Parser exception for xx/AndroidManifest.xml: The reference to entity "z" must end with the ';' delim
- "An extender can't be in a different UpdatePanel than the control it extends." error really needs debugging information ,错误
- The value of attribute "description" associated with an element type "target" must not contain the '<' character.
- Attribute name "aphmodel" associated with an element type "mxg" must be followed by the ' = ' charac
- System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermi
- About Derby "ERROR 42X51: The class '***' does not exist or is inaccessible. This can hap pen if the class is not public."
- Cannot find an initializer for type '[(String)]' that accepts an argument list of type '(LazyForward
- The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels, in .pn
- "Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace"问题解决
- Can not find the tag library descriptor for "http://struts.apache.org/tags-bean
- Can not find the tag library descriptor for "http://java.sun.com/j...
- <s:if test="canSubscribe == 'Y'">能 </s:if> <s:else>不能 </s:else> 单字符需加.toString()