EmguCV3.0幾個控制項的使用

來源:互聯網
上載者:User

標籤:

 

值方圖(Histogram)是一種統計圖資料,在影像處理中最常被用來統計一張映像或是感興趣(ROI)地區的色彩分布,在這邊本人使用的EmguCV 2.4.0版的內建值方圖工具只有被包含在WinForm應用程式中至於要如何在WPF繪製值方圖,那就要花比較多的步驟了,我們得自己畫,這部分後續文章會在介紹

 所以接下來介紹的繪製環境是在C#的WinForm項目, 步驟 1.加入HistogramBox組件到WinForm 點選上排工具 –> 選擇工具箱 –> .Net Framework 組件中點選選擇,找到EmguCV項目下的Emgu.CV.UI.dll並把dll加入後再次看一下.Net Framework 組件便會發現: 
 2.在Form的設計工具箱中便會找到HistogramBox  
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using Emgu.CV;using Emgu.CV.Structure;using Emgu.CV.UI;namespace WindowsFormsApplication1{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }                /*         * 第一對         * HistogramBox The control that is used to display histogram(需要事先設計位置)         * HistogramViewer A view for histogram(彈出新視窗,不需要事先設計)           * 第二對         * ImageBox An image box is a user control that is similar to picture box, but display Emgu CV IImage and provides enhenced functionalities.         * ImageViewer The Image viewer that display IImage         * 第三對         * MatrixBox A control that is used to visualize a matrix(使用者控制項)          * MatrixViewer A MatrixViewer that is used to visualize a matrix(快顯視窗)         *          * 第四個         * Operation An operation contains the MethodInfo and the methods parameters. It provides a way to invoke a specific method with the specific parameters.           * PanAndZoomPictureBox A picture box with pan and zoom functionality (可以事先映像的縮放)         */        private void Form1_Load(object sender, EventArgs e)        {            Image<Bgr, byte> img = new Image<Bgr, byte>(@"C:\a2.jpg");                        //Emgu.CV.UI.ImageBox 需要在視窗中設計            this.imageBox1.Image = img;            this.matrixBox1.Matrix = img;            this.panAndZoomPictureBox1.Image = Image.FromFile(@"C:\a1.jpg");            //The Imageviewer 直接彈出新的視窗            Image<Bgr, byte> loadImg = new Image<Bgr, byte>(@"C:\a1.jpg");            ImageViewer viewer = new ImageViewer(loadImg, "Loaded Image");            viewer.Show(this);                       //1.使用HistogramViewer不需要事先拉到設計視窗中,他是快顯視窗,你只需要直接使用便可以            HistogramViewer.Show(loadImg[0], 32); //image[0] 顯示Blue,bin = 32            HistogramViewer.Show(loadImg, 32); //顯示所有通道                        //2.使用HistogramBox,需要事先拉視窗中設定在視窗畫面            this.histogramBox1.GenerateHistograms(loadImg, 32);            this.histogramBox1.Refresh(); //如果不重新整理,映像顯示一部分,沒有自動縮放的功能            //this.histogramBox1.Show(); //如果不是重新整理映像,有沒有都可以        }    }}

 

 

EmguCV3.0幾個控制項的使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.