加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

Windows7 64位机上Emgu CV2 4 2安装与配置

发布时间:2020-12-14 02:35:51 所属栏目:Windows 来源:网络整理
导读:1. ????? 从 http://sourceforge.net/projects/emgucv/?source=directory 下载最新的 Emgu CV2.4.2 ; 2. ????? 将 libemgucv-windows-x86-gpu-2.4.2.1777 拷贝到 D:softEmgu2.4.2 文件夹下,运行此 .exe 文件,将其安装到 D:softEmgu2.4.2emgucv-windo

1.????? 从http://sourceforge.net/projects/emgucv/?source=directory下载最新的Emgu CV2.4.2

2.????? 将libemgucv-windows-x86-gpu-2.4.2.1777拷贝到D:softEmgu2.4.2文件夹下,运行此.exe文件,将其安装到D:softEmgu2.4.2emgucv-windows-x86-gpu2.4.2.1777文件夹下,安装完后会自动重启;

3.????? 将D:softEmgu2.4.2emgucv-windows-x86-gpu2.4.2.1777binD:softEmgu2.4.2emgucv-windows-x86-gpu2.4.2.1777binx86(x86文件夹下包含有对应的OpenCV2.4.2的动态库,将此目录加入到环境变量后Emgu不需要额外的安装相对应的OpenCV);添加到系统环境变量Path中,重启;

4.????? 打开vs2008,新建一个基于Windows窗体的应用程序;

5.????? 导入UI插件:Tool-->Choose Toolbox Items-->.NET Framework Components-->点击Browse,选中D:softEmgu2.4.2emgucv-windows-x86-gpu2.4.2.1777bin下的Emgu.CV.UI.dll打开,会在列表中新增HistogramBoxImageBoxMatrixBoxPanAndZoomPictureBox四项;

6.????? 添加引用:选中工程下的References-->Add Reference-->Browse选中D:softEmgu2.4.2emgucv-windows-x86-gpu2.4.2.1777bin下的Emgu.CV.dllEmgu.CV.ML.dll Emgu.CV.UI.dll Emgu.Util.dllZedGraph.dll 5个动态库,点击OK

7.????? 点击Solution Platforms-->Configuration ManagerActive solution platform将原来的Any CPU改为x86,否则会提示“Emgu.CV.CvInvoke的类型初始值设定项引发异常”的错误。

?

网上的一个代码示例,编译、运行成功:

?

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

?

usingEmgu.CV;//Emgu

usingEmgu.CV.Structure;

usingEmgu.Util;

usingSystem.Threading;

?

namespaceTestEmgu

{

??? public partial class Form1 : Form

??? {

???????public Form1()

???????{

???????????InitializeComponent();

???????}

?

???????privateCapturecapture;

???????privateboolcaptureinprocess;//判断摄像头的状态

?

???????privatevoidbutton1_Click(objectsender,EventArgse)

???????{

???????????if(capture !=null)

???????????{

???????????????if(captureinprocess)

???????????????{

???????????????????Application.Idle -=new EventHandler(processframe);

?

???????????????????button1.Text ="stop!";

???????????????}

???????????????else

???????????????{

???????????????????Application.Idle +=new EventHandler(processframe);

?

???????????????????button1.Text ="start!";

???????????????}

?

???????????????captureinprocess= !captureinprocess;

???????????}

???????????else//摄像头为空,则通过Capture()方法调用

???????????{

???????????????try

???????????????{

???????????????????capture= newCapture();

???????????????}

???????????????catch(NullReferenceExceptionexcpt)

???????????????{

???????????????????MessageBox.Show(excpt.Message);

???????????????}

???????????}

???????}

?

???????privatevoidprocessframe(objectsender,EventArgsarg)

???????{

???????????Image<Bgr,Byte> frame =capture.QueryFrame();

?

???????????imageBox1.Image =frame;

???????}

??? }

}

?

参考文献:

1.? http://www.emgu.com/wiki/

2.? http://blog.163.com/[email?protected]/blog/static/71379539201282511180304/

3.? http://www.voidcn.com/article/p-hncxmwxa-kg.html

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读