Windows7 64位機上Emgu CV2.4.2安裝與配置

來源:互聯網
上載者:User

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

2.      將libemgucv-windows-x86-gpu-2.4.2.1777拷貝到D:\soft\Emgu2.4.2檔案夾下,運行此.exe檔案,將其安裝到D:\soft\Emgu2.4.2\emgucv-windows-x86-gpu2.4.2.1777檔案夾下,安裝完後會自動重啟;

3.      將D:\soft\Emgu2.4.2\emgucv-windows-x86-gpu2.4.2.1777\bin;D:\soft\Emgu2.4.2\emgucv-windows-x86-gpu2.4.2.1777\bin\x86(此x86檔案夾下包含有對應的OpenCV2.4.2的動態庫,將此目錄加入到環境變數後Emgu不需要額外的安裝相對應的OpenCV);添加到系統內容變數Path中,重啟;

4.      開啟vs2008,建立一個基於Windows表單的應用程式;

5.      匯入UI外掛程式:Tool-->Choose Toolbox Items-->.NET
Framework Components-->點擊Browse,選中D:\soft\Emgu2.4.2\emgucv-windows-x86-gpu2.4.2.1777\bin下的Emgu.CV.UI.dll開啟,會在列表中新增HistogramBox、ImageBox、MatrixBox、PanAndZoomPictureBox四項;

6.      添加引用:選中工程下的References-->Add Reference-->Browse選中D:\soft\Emgu2.4.2\emgucv-windows-x86-gpu2.4.2.1777\bin下的Emgu.CV.dll、Emgu.CV.ML.dll、
Emgu.CV.UI.dll、 Emgu.Util.dll、ZedGraph.dll 5個動態庫,點擊OK;

7.      點擊Solution Platforms-->Configuration Manager:Active 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/woshitony111@126/blog/static/71379539201282511180304/

3. 
http://blog.csdn.net/gaaranaruto/article/details/6328358

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.