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. linux日常管理-防火墙netfilter工具-iptables-1

    防火墙的名字叫 netfilter 工具/命令叫iptables 命令:iptables 选项: -t   指定表 -A 在最上面增加一条规则 -I 在最下面增加一条规则 -D 删除一条规则 -A-I ...

  2. shell入门-特殊符号

    特殊符号:* 说明:通配符,多个字符.所有后缀为”.txt“的文件列出来 [root@wangshaojun 111]# ls *.txt11.txt 1.txt 22.txt 2.txt 33.tx ...

  3. web安全之XSS和CSRF

    XSS 跨站脚本攻击(cross site script),本来缩写CSS单位了和层叠样式(Cascading Style Sheet,CSS)有所区别,所以在安全领域叫做“XSS”. XSS攻击,通 ...

  4. 2017清北学堂(提高组精英班)集训笔记——动态规划Part3

    现在是晚上十二点半,好累(无奈脸),接着给各位——也是给自己,更新笔记吧~ 序列型状态划分: 经典例题:乘积最大(Luogu 1018) * 设有一个长度为 N 的数字串,要求选手使用 K 个乘号将它 ...

  5. [cf839d]Winter is here容斥原理

    题意:给定一个数列${a_i}$,若子序列长度为$k$,最大公约数为$gcd$,定义子序列的权值为$k*\gcd (\gcd  > 1)$.求所有子序列的权值和. 答案对10^9+7取模. 解题 ...

  6. spring 4.0 注解数据验证1

    通常情况下,数据验证都分为前台验证,后台验证.并且前台JS验证是肯定有的,那么其实验证的错误信息根本不必通过后台传过去,哪怕就是想国际化,前台JS也能够胜任. 如果前台验证足够了,那么如果还有不正确的 ...

  7. StringBuffer输出

    public class Test { public static void main(String[] args) { StringBuffer a = new StringBuffer(" ...

  8. Note: Eleos: ExitLess OS Services for SGX Enclaves

    Eleos increased I/O and memory intensive SGX program execution performance with In-enclave system ca ...

  9. [hdu 1671] Phone List - Trie

    Given a list of phone numbers, determine if it is consistent in the sense that no number is the pref ...

  10. elasticsearch 增删改流程和写一致性

    增删改流程: 1. 客户端和任一节点(假设 Node1)发出请求,这个node就是coordinating node(协调节点) 2. coordinating node,对document进行路由, ...