• "Emgu.CV.CvInvoke”的类型初始值设定项引发异常 解决办法


    系统win7 32位,只在这一台电脑上出现这种问题,已知VS编译是X86,在数台电脑上测试都正常。

    后来把opencv的dll路径例如 E:...x86  加入到系统环境变量中就正常了。

    emgucv安装里opencv的dll路径是这个样子 C:Emguemgucv-windows-universal 3.0.0.2157inx86,发布时把bin下的dll包括x86等拷贝到程序安装目录下。

    但很奇怪这一台电脑无法使用,理论上emgucv发布不需要环境变量的。

    还是要继续研究,欢迎知道的解答下。

    官方解释:

    The type initializer for 'Emgu.CV.CvInvoke' threw an exception.

    If you see this exception, please check the following

    Have you installed MSVCRT?

    • For Version 3.0+, the required vcrt dlls are included in the "x86" and "x64" folder. You will be ready as long as you copy all the unmanaged dlls in the "x86" and "x64" folder to the folder of executable.
    • For Version 2.4+, the bundled OpenCV binary is build with Visual Studio 2010, you will needs to installed MSVCRT 10.0 SP1 x86 or MSVCRT 10.0 SP1 x64 to resolve the dependency issue.
    • For Version 2.0+, the bundled OpenCV binary is build with Visual Studio 2008, you will needs to installed MSVCRT 9.0 SP1 to resolve the dependency issue.
    • For Version 1.5, the bundled OpenCV pre1.1 binary is build with Visual Studio 2005, you will needs to installed MSVCRT 8.0 SP1 to resolve the dependency issue.

    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.4.2, this means the "x86" and "x64" folder and all the dlls within the folders. The folder names and file structures should not be altered when deploying with the application.
      • For EMGU CV version 2.4 cudart64_42_9.dll, cvextern.dll, npp64_42_9.dll, opencv_calib3dXXX.dll, opencv_contribXXX.dll, opencv_coreXXX.dll, opencv_features2dXXX.dll, opencv_flannXXX.dll, opencv_highguiXXX.dll, opencv_imgprocXXX.dll, opencv_legacyXXX.dll, opencv_mlXXX.dll, opencv_nonfreXXX.dll, opencv_objectdetectXXX.dll, opencv_videoXXX.dll,</code?> where <code>XXX is the OpenCV version number.
      • For Emgu CV version 2.2, 2.3 this means the following 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 OpenCV version number.
      • For Emgu CV version <= 2.1, this means the following dlls:cvXXX.dll, cvauxXXX.dll, cxcoreXXX.dll, highguiXXX.dll, opencv_ffmpegXXX.dll, mlXXX.dllcvextern.dll where XXX is the OpenCV version 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->Existing Item and select all unmanaged DLLs. Add them to the project.
      • For each of the included Dlls, left click on it, find the "Copy to Output Directory" option and select "Copy if newer"

    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 the Exception

    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 you project, 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 out the InnerException and report it to the discussion forum

  • 相关阅读:
    div弹出层
    经典SQL语句
    sql连接及操作
    给flash加上连接
    在c#中图片原比例缩放
    悬浮提示筐
    拖动板块
    IFrame自适应高度
    SQL语句中的日期计算
    注意Request.Cookies["UserID"]的用法
  • 原文地址:https://www.cnblogs.com/jhlong/p/5439383.html
Copyright © 2020-2023  润新知