zoukankan      html  css  js  c++  java
  • 【Emgu】一起学EmguCV(一)配置与使用

      首先先介绍一下OpenCV,OpenCV的全称是:Open Source Computer Vision Library,OpenCV是一个基于(开源)发行的跨平台计算机视觉库,可以运行在Linux、Windows和Mac OS操作系统上。它轻量级而且高效——由一系列 C 函数和少量 C++ 类构成,同时提供了Python、Ruby、MATLAB等语言的接口,实现了图像处理和计算机视觉方面的很多通用算法。OpenCV 拥有包括 300 多个C函数的跨平台的中、高层 API。它不依赖于其它的外部库——尽管也可以使用某些外部库。
      OpenCV中文学习站点 http://www.opencv.org.cn
     
      EmguCV是OpenCV的一个跨平台的.Net封装,由于OpenCV是用C和C++编写的,Emgu用C#对其进行封装,允许用.Net语言来调用OpenCV函数,如C#、VB、VC++等,同时该封装也可以被编译到Mono平台和允许在Windows、Mac OS、Android、iPhone、iPad等多个平台上运行
     
    特性:
      Image class with Generic Color and Depth
      Automatic garbage collection(自动垃圾回收)
      Xml Serializable Image(用于网络)
      Image class / Direct invoke function from OpenCV(直接对OpenCV函数的invoke操作)
      Generic operations on image pixel(对像素操作)
     
    接下来看看EmguCV的使用
      
    1、到Emgu官方下载Emgu库 http://www.emgu.com
      这里使用的是   libemgucv-windows-universal-gpu-2.4.9.1847.exe (228.6 MB)
     
    2、解压或安装完后得到下面文件
     
      先安装 vcredist_x86 (如果需要开发的是64位的程序,择安装x64版本,我是两个都装)
     
    3、进入bin/x86文件夹
      图中框出来的是运行时所需要的依赖文件,在开发时,需要把这些文件复制到程序的Debug文件夹内,不然会抛出 TypeInitializerException 异常
     
     
    4、有关Emgu相关的类都在bin文件夹里面
    5、下面演示一下Hello World程序
      新建一个工程,引用两个库 
     
      引用命名控件,记得还要把上面框出来的OpenCV依赖文件复制到Debug目录下
            using Emgu.CV;
            using Emgu.CV.CvEnum;
            using Emgu.CV.Structure;

      添加一个按钮,一个PictureBox控件

            private void button1_Click(object sender, EventArgs e)
            {
                Image<Bgr, byte> img = new Image<Bgr, byte>(480, 320, new Bgr(0, 255, 0));
    
                MCvFont f = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 1.0, 1.0);
                img.Draw("hello world", ref f, new Point(10, 80), new Bgr(0, 0, 0));
                pictureBox1.Image = img.ToBitmap();
            }

     
     
  • 相关阅读:
    LintCode "Maximum Gap"
    LintCode "Wood Cut"
    LintCode "Expression Evaluation"
    LintCode "Find Peak Element II"
    LintCode "Remove Node in Binary Search Tree"
    LintCode "Delete Digits"
    LintCode "Binary Representation"
    LeetCode "Game of Life"
    LintCode "Coins in a Line"
    LintCode "Word Break"
  • 原文地址:https://www.cnblogs.com/bomo/p/2986113.html
Copyright © 2011-2022 走看看