Emgu CV 初试
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,然后完成操作。
example1:C#下的openCV(Emgu CV)
example2:VS2010+C#+EmguCV读取和录制视频
example3:C#使用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
andEmgu.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}.dll
, opencv_contrib{XXX}.dll
, opencv_core{XXX}.dll
, opencv_features2d{XXX}.dll
, opencv_ffmpeg{XXX}.dll
,opencv_flann{XXX}.dll
, opencv_gpu{XXX}.dll
, opencv_highgui{XXX}.dll
, opencv_imgproc{XXX}.dll
, opencv_legacy{XXX}.dll
, opencv_ml{XXX}.dll
,opencv_objdetect{XXX}.dll
, opencv_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
whereXXX
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
whereXXX
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,
whereXXX
is the OpenCV version number.
- For Emgu CV version <= 2.1, this means the following dlls:
- 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 初试的更多相关文章
- 基于Emgu CV的人脸检测代码
这个提供的代码例子是Emgu CV提供的源码里面自带的例子,很好用,基本不需要改,代码做的是人脸检测不是人脸识别,这个要分清楚.再就是新版本的Emgu CV可能会遇到系统32位和64位处理方式有区别的 ...
- 自己积累的一些Emgu CV代码(主要有图片格式转换,图片裁剪,图片翻转,图片旋转和图片平移等功能)
using System; using System.Drawing; using Emgu.CV; using Emgu.CV.CvEnum; using Emgu.CV.Structure; na ...
- Emgu.CV 播放视频
using Emgu.CV; using System; using System.Drawing; using System.Threading; using System.Windows.Form ...
- Emgu.CV/opencv 绘图 线面文字包括中文
绘图很简单 Emgu.CV.Image<Bgr, Byte> image; 使用image.Draw可以画各种图形和文字包括英文及数字,不支持中文 CircleF circle = ...
- yuv420p转为emgucv的图像格式Emgu.CV.Image<Bgr, Byte>
GCHandle handle = GCHandle.Alloc(yuvs, GCHandleType.Pinned); Emgu.CV.Image<Bgr, Byte> image = ...
- "Emgu.CV.CvInvoke”的类型初始值设定项引发异常 解决办法
系统win7 32位,只在这一台电脑上出现这种问题,已知VS编译是X86,在数台电脑上测试都正常. 后来把opencv的dll路径例如 E:\...\x86 加入到系统环境变量中就正常了. emgu ...
- EmguCV控件Emgu.CV.UI.ImageBox及C# picturebox显示图片连续刷新出现闪烁问题
在上一篇里,EmguCV(OpenCV)实现高效显示汉字及叠加 实现了视频叠加及显示,但存在问题,就是 Emgu.CV.UI.ImageBox及C# picturebox显示图片时都会出现闪烁,尤其 ...
- 基于Emgu cv的图像拼接(转)
分类: 编程 C# Emgu cv Stitching 2012-10-27 11:04 753人阅读 评论(1) 收藏 举报 在新版本的Emgu cv中添加了Emgu.CV.Stitching,这极 ...
- [转载+原创]Emgu CV on C# (七) —— Emgu CV on 轮廓检测
轮廓检测 对于查找轮廓我们一般要对图像Canny检测.但是对于很特殊的场合其实我们还可以直接对二值化的图像进行轮廓的提取. 关键函数 1. cvFindContours Retrieves conto ...
随机推荐
- Django框架之第三篇模板语法
一.什么是模板? 只要是在html里面有模板语法就不是html文件了,这样的文件就叫做模板. 二.模板语法分类 一.模板语法之变量:语法为 {{ }}: 在 Django 模板中遍历复杂数据结构的关键 ...
- route-显示并设置Linux内核中的网络路由表
route命令 网络配置 route命令用来显示并设置Linux内核中的网络路由表,route命令设置的路由主要是静态路由.要实现两个不同的子网之间的通信,需要一台连接两个网络的路由器,或者同时位于两 ...
- groupadd添加新组
一.groupadd命令用于将新组加入系统. 格式groupadd [-g gid] [-o]] [-r] [-f] groupname 主要参数 -g gid:指定组ID号. -o:允许组ID号,不 ...
- windows10 启用Linux子系统
转载 https://jingyan.baidu.com/article/e2284b2b99a327e2e6118d38.html 打开Windows下 设置--更新和安全--针对开发人员--选中“ ...
- Java学习之多态(Polymorphism)
多态==晚绑定 不要把函数重载理解为多态. 因为多态是一种运行期的行为,不是编译期的行为. 多态:父类型的引用可以指向子类型的对象. 比如 Parent p = new Child(); 当使用多态方 ...
- 使用JSP输出九九乘法表
在html网页中编写Java代码是,需要使用<%%>来编写,<%=%>表示取等号后面的值,如<%="hello"%>就会输出hello. < ...
- jquery 简单入门
例:GridView
- SpringFox 初体验
本文来自网易云社区. 1.什么是SpringFox? 1.1 Springfox 是一个开源的API Doc的框架, 它的前身是swagger-springmvc,可以将我们的Controller中的 ...
- 解决Navicat 连接服务器数据库报10060问题
1.登录mysql,授予远程登录权限(确保mysql表里的登录user对应的host为 % 即可:若不是 % ,使用mysql的update更新对应host) mysql> use mysql; ...
- Python实现返回指定范围内的所有素数
# 获取a, b范围的所有素数 def func(a, b): li = [] for i in range(a, b+1): for j in range(2, i): if i % j == 0: ...