Emgu CV 是.NET平台下对OpenCV图像处理库的封装,也就是.NET版。可以运行在C#、VB、VC++等。

安装完成后需要设置环境变量,比如我安装在D:\Emgu\emgucv-windows-universal-cuda 2.9.0.1922,然后再系统环境变量添加D:\Emgu\emgucv-windows-universal-cuda 2.9.0.192\bin即可

Emgu CV下载地址

http://sourceforge.net/projects/emgucv/files/

找最新的下就行了,傻瓜式安装,选择目录后自动完成安装,然后提示安装VS2008和VS2010的插件,我使用的是VS2010,然后完成操作。

example1C#下的openCV(Emgu CV)

example2VS2010+C#+EmguCV读取和录制视频

example3C#使用EmguCV实现视频读取和播放

Emgu.CV.CvInvoke 的类型初始值设定项引发异常

reference:VS2010、C#、Emgu CV配置 ;

首先确定没有重复安装opencv和emgucv两种,这样有可能在配置path时会出错。emgucv是包含opencv的,使用C#开发的朋友们,可以放心的只安装emgucv。

1、如遇错误提示:tbb_debug.dll找不到

请下载安装Intel TBB库,需要将tbb库或dll文件所在路径,配置带系统环境变量path中。

2、如遇错误提示:“Emgu.CV.CvInvoke”的类型初始值设定项引发异常

(1)、注销或重启计算机,使得系统环境变量中的path生效;

(2)、通过path中设置的路径去寻找对应的dll文件,查看是否存在,是否被成功引用到VS中;

(3)、copy dll文件到debug和release目录中。

(4)、尝试将.Net FrameWork版本降低,如果是4.0的就降低到3.5,如果是3.5的就降低到2.0。

官方解决办法:

(1)安装时注意:

ou can run an AutoIt script that automates much of the process, including installing OpenCV if necessary, and lets you start developing with Visual Studio right away.

Getting the Dependency

  • Emgu CV use WCF(Windows Communication Foundation) therefore requires .Net 3.0
  • For version 2.4+ the bundled OpenCV binary is build with Visual Studio 2010, you will needs to installed MSVCRT 9.0 SP1 x86 or MSVCRT 9.0 SP1 x64to 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.

Building the Examples

  • Follow this link to the file server on Source Forge.
  • Download and extract the windows installer.
  • Install the software
  • Go to the Solution folder
    • If you are using Visual Studio 2008, browse to VS2008
    • If you are using Visual Studio 2010, browse to VS2010
  • Open Emgu.CV.Example.sln and build the solution. At this point, you should be able to run the example programs.

Creating a New Project in Visual Studio

To use the framework in Visual Studio, you need to

  • Download and extract the binary files package Emgu.CV.Windows.Binary-{version}.zip

For a Full guide to using the dependencies under Visual Studio and C# see the C# Tutorial.

Core Functionality

Managed Code
  • Create a new Visual Studio project or use an existing one
  • Add the two files Emgu.Utils.dll and Emgu.CV.dll to References of the project. as well.
  • Optionally put the following lines in the top of your code to include the Emgu.CV namespace.
using Emgu.CV; using Emgu.CV.Structure;
Open CV unmanaged dll

Copy the OpenCV dll files: opencv_calib3d{XXX}.dllopencv_contrib{XXX}.dllopencv_core{XXX}.dllopencv_features2d{XXX}.dllopencv_ffmpeg{XXX}.dll,opencv_flann{XXX}.dllopencv_gpu{XXX}.dllopencv_highgui{XXX}.dllopencv_imgproc{XXX}.dllopencv_legacy{XXX}.dllopencv_ml{XXX}.dll,opencv_objdetect{XXX}.dllopencv_video{XXX}.dll and cvextern.dll to the execution directory, where {XXX} is the OpenCV version number.

(2)The type initializer for 'Emgu.CV.CvInvoke' threw an exception.(Emgu.CV.CvInvoke 的类型初始值设定项引发异常)

If you see this exception, please check the following

Have you installed MSVCRT?

  • 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.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.
    • 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.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, 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"  

最新文章

  1. shell脚本删除指定mobileprovision
  2. DDD领域驱动设计实践篇之如何提取模型
  3. 前端chrome浏览器调试总结
  4. IOS圆头像
  5. NOI题库分治算法刷题记录
  6. BZOJ2981 : [Poi2002]括号
  7. To change the sharepoint CA port
  8. mongodb数据库连接池(java版)
  9. C# 执行批处理文件(*.bat)的方法代码
  10. Effective C++ 总结(二)
  11. codevs 1746 贪吃的九头龙
  12. GitHub以及Git学习 持续编辑学习中
  13. vue2.0 vetur插件提示 &#39;v-for&#39; directives require &#39;v-bind:key&#39; directives 的解决办法
  14. HTML常用特殊字符编码对照表以及其对应英文
  15. LGOJ P3834 【模板】可持久化线段树 1(主席树)
  16. go语言之进阶篇字符串转换
  17. 查询系统负载信息 Linux 命令详解
  18. C++ 标准输出cout与printf
  19. 偶数求1/2+1/4+...+1/n奇数1/1+1/3+...+1/n
  20. 深入浅出 关于SQL Server中的死锁问题

热门文章

  1. hibernate 持久化对象的生命周期
  2. Qt乱码解决办法(常量中有换行符)
  3. js数组中的reverse()方法
  4. 15、使用ggtree实现进化树的可视化和注释(转载)
  5. CodeForces 492D Vanya and Computer Game (思维题)
  6. Struts简单入门实例
  7. datatables的使用
  8. 连接mysql时报:message from server: &quot;Host &#39;192.168.76.89&#39; is not allowed to connect to this MySQL server 处理方案
  9. Unity 2018中的图形渲染
  10. Unity技术支持团队性能优化经验分享