EmguCV_開發學習歷程_2_從官網做學習(改變策略)_成功秀圖_使用最新版Emgu3.0


這次我們來官網做學習  不要再走冤望路了



http://www.emgu.com/wiki/index.php/Main_Page





















這裡是  3.0  的  連結

http://www.emgu.com/wiki/files/3.0.0/document/html/8dee1f02-8c8a-4e37-87f4-05e10c39f27d.htm





點開裏頭會介紹各個命名空間的使用與配置方式























EmguCV Installer

https://www.zianchoy.com/emguCVInstaller/


Setting up EMGU C Sharp

http://www.emgu.com/wiki/index.php/Setting_up_EMGU_C_Sharp



=====================================================

Step1.

先去sourceforge下載Emgu安裝檔

http://sourceforge.net/projects/emgucv/


Step2.











The Basic Requirements  

開啟visual studio ---->  新增  C#   WindowsForm專案 --->  








對專案右鍵---->加入----->現有項目

























把這三個dll加入Emgu.CV.dll
Emgu.CV.UI.dll
Emgu.Util.dll




這三個dll是前面提到的EMGU特定的C#庫。


Step3.


EMGU.CV.Invoke Exception


x64 Architecture


再來我們要調校   EMGU.CV.Invoke  型別初始化設定的例外

Right click on your project file in the solution explorer and select “Properties” 
右擊右方  『方案總管』  選擇最底  『屬性』






















Select the “Build” tab from the ribbon bar on the right of this window. 
There will be an option for Platform Target: with a drop down menu change this from x86 to x64. 

這邊我們需要改變一下  是去組態-->組態管理員-->改成x64





















Step4.


A Basic Program

用picturebox秀圖

private void button1_Click(object sender, EventArgs e)
    {
        OpenFileDialog Openfile = new OpenFileDialog();
        if (Openfile.ShowDialog() == DialogResult.OK)
        {
            Image<Bgr, Byte> My_Image = new Image<Bgr, byte>(Openfile.FileName);
            pictureBox1.Image = My_Image.ToBitmap();
        }
    }

There has been a button item and a picturebox item added to the main form. 




這裡參考此篇博客 https://dotblogs.com.tw/v6610688/archive/2013/12/20/install_emgucv_2_4_win8_win7.aspx

紀錄這兩個參考路程
C:\libemgucv-windows-universal-3.0.0.2157\bin\x64\
C:\libemgucv-windows-universal-3.0.0.2157\bin\





(一)加入參考路徑在visual studio 專案  >> 屬性 >> 參考路徑 >> 加入兩參考路徑
























(二)加入系統環境變數



目前重啟專案仍會出現

紅波浪狀況

原因
注意自己是否有忘記
引用參考

法1.加入參考法

另外也可去這
法二.去emgucv這包API中把這三個檔案丟到你自設專案的bin目錄也可

點擊    秀圖

選擇  想秀的圖




秀圖的觸發程式碼






















private void button1_Click(object sender, EventArgs e)
{
            OpenFileDialog Openfile = new OpenFileDialog();
            if (Openfile.ShowDialog() == DialogResult.OK)
            {
                Image<Bgr, Byte> My_Image = new Image<Bgr, byte>(Openfile.FileName);
                pictureBox1.Image = My_Image.ToBitmap();

            }
}


留言

這個網誌中的熱門文章

經得起原始碼資安弱點掃描的程式設計習慣培養(五)_Missing HSTS Header

經得起原始碼資安弱點掃描的程式設計習慣培養(三)_7.Cross Site Scripting(XSS)_Stored XSS_Reflected XSS All Clients

(2021年度)駕訓學科筆試準備題庫歸納分析_法規是非題