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"  

Emgu CV 初试的更多相关文章

  1. 基于Emgu CV的人脸检测代码

    这个提供的代码例子是Emgu CV提供的源码里面自带的例子,很好用,基本不需要改,代码做的是人脸检测不是人脸识别,这个要分清楚.再就是新版本的Emgu CV可能会遇到系统32位和64位处理方式有区别的 ...

  2. 自己积累的一些Emgu CV代码(主要有图片格式转换,图片裁剪,图片翻转,图片旋转和图片平移等功能)

    using System; using System.Drawing; using Emgu.CV; using Emgu.CV.CvEnum; using Emgu.CV.Structure; na ...

  3. Emgu.CV 播放视频

    using Emgu.CV; using System; using System.Drawing; using System.Threading; using System.Windows.Form ...

  4. Emgu.CV/opencv 绘图 线面文字包括中文

    绘图很简单 Emgu.CV.Image<Bgr, Byte> image;   使用image.Draw可以画各种图形和文字包括英文及数字,不支持中文   CircleF circle = ...

  5. yuv420p转为emgucv的图像格式Emgu.CV.Image<Bgr, Byte>

    GCHandle handle = GCHandle.Alloc(yuvs, GCHandleType.Pinned); Emgu.CV.Image<Bgr, Byte> image = ...

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

    系统win7 32位,只在这一台电脑上出现这种问题,已知VS编译是X86,在数台电脑上测试都正常. 后来把opencv的dll路径例如 E:\...\x86  加入到系统环境变量中就正常了. emgu ...

  7. EmguCV控件Emgu.CV.UI.ImageBox及C# picturebox显示图片连续刷新出现闪烁问题

    在上一篇里,EmguCV(OpenCV)实现高效显示汉字及叠加  实现了视频叠加及显示,但存在问题,就是 Emgu.CV.UI.ImageBox及C# picturebox显示图片时都会出现闪烁,尤其 ...

  8. 基于Emgu cv的图像拼接(转)

    分类: 编程 C# Emgu cv Stitching 2012-10-27 11:04 753人阅读 评论(1) 收藏 举报 在新版本的Emgu cv中添加了Emgu.CV.Stitching,这极 ...

  9. [转载+原创]Emgu CV on C# (七) —— Emgu CV on 轮廓检测

    轮廓检测 对于查找轮廓我们一般要对图像Canny检测.但是对于很特殊的场合其实我们还可以直接对二值化的图像进行轮廓的提取. 关键函数 1. cvFindContours Retrieves conto ...

随机推荐

  1. [.net]手机APP与IIS服务器联调配置

    前端时间写过一段时间接口,在后期的时候,出现了一些无法通过查看日志来找出问题所在的bug.于是,将手机APP连接到IIS服务器上进行调试,下面是配置的具体步骤 1. 配置IIS  添加网站,将物理路径 ...

  2. springMVC绑定json参数之二(2.2.1)

    二.springmvc 接收不同格式的json字符串 2.扫盲完了继续测试springmvc 接收不同格式的json字符串 1).格式一:json简单数组对象 前台两种传递方式: 方式一(需要拼接js ...

  3. [51nod1267]4个数和为0(预处理+双指针)

    题意:判断能否从序列中找出4个数的和为0. 解题关键:n^2预处理任意两个数的和,sort一下,双指针进行判定. 此解法尚存在一个问题,就是左右枚举的时候如果相同的有许多的时候该左边移动还是右边移动 ...

  4. 面试题: 数据库 真实面试题已看1 操作语句 存储过程 挺好 sql语句练习 有用

    今天到某公司笔试,数据库考的比较多,但是说老实话,考的也比较基础.现在趁回忆得起来,将数据库知识简单整理如下: 一.建表指令 比如创建一个学生表student,它由学号Sno,姓名Sname,性别Ss ...

  5. 6、R语言绘制带errorbar 的柱状图

    转载:http://www.cnblogs.com/xudongliang/p/7283733.html data <- data.frame(mean = c(10, 15), sd = c( ...

  6. 1、linux-wget

    1.常用下载与参数 wget + 空格 + 要下载文件的url路径 例如: # wget linuxsense.org/xxxx/xxx.tar.gz">http://www.linu ...

  7. 关于C/C++中的“auto”关键字

    C/C++ 98标准 C++03标准 早在C++98标准中就存在了auto关键字,那时的auto用于声明变量为自动变量,自动变量意为拥有自动的生命期.此用法是多余的,因为即使定义变量时不加" ...

  8. day1_2_3

    DD烧写命令(mfgtools-without-rootfs.tar.gz) ubuntu minicom svn 应用层进程阻塞调试 多机共享 securecrt的远程登录以及调试 tengxunt ...

  9. Java基础 -- 泛型之泛型参数

    泛型机制常用的参数有3个: “?”代表任意类型.如果只指定了<?>,而没有extends,则默认是允许任意类. extends关键字声明了类型的上界,表示参数化的类型可能是所指定的类型,或 ...

  10. iphone5 A1429国行IOS8.4.1 越狱 完美使用电信3G

    国航 8.4.1,越狱,使用电信3G,能打电话,能发短信,正常上网使.(越狱降级方式,请参照本文末端连接) 有好多人说不管怎么试都是无服务,请查看 设置-蜂窝移动网络-漫游里面,必须只有 语音漫游 这 ...