EmguCV3.0几个控件的使用
2024-08-24 02:32:44
值方图(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[], ); //image[0] 显示Blue,bin = 32
HistogramViewer.Show(loadImg, ); //显示所有信道 //2.使用HistogramBox,需要事先拉窗口中设定在窗口画面
this.histogramBox1.GenerateHistograms(loadImg, );
this.histogramBox1.Refresh(); //如果不刷新,图像显示一部分,没有自动缩放的功能
//this.histogramBox1.Show(); //如果不是刷新图像,有没有都可以
}
}
}
最新文章
- python logging模块详解[转]
- Async Programming - 1 async-await 糖的本质(1)
- python日常-int和float
- HTTPS是如何保证连接安全,你知道吗?
- Context上下文对象(抄书的)
- 删除链表中全部值为k的节点
- C语言遍历一个文件夹下面的所有文件
- cocos2d-x 3.0 final 中文显示
- 了解神奇的this
- (Problem 6)Sum square difference
- FZU 2113(数位dp)
- C语言课程设计 Win32应用程序
- mynotebook
- NOIP2015 D2T3 洛谷2680 BZOJ4326 运输计划 解题报告
- Python 标准类库 - 因特网协议与支持之socketserver
- 不转实体直接获取Json字符串中某个字段的值
- [转载]EF或LINQ 查询时使用IN并且根据列表自定义排序方法
- 线程同步Volatile与Synchronized(一)
- python 常库介绍及安装方法
- JS closure
热门文章
- 80X86寄存器详解<;转载>;
- hadoop集群安装规划
- matplotlib画子图时设置总标题
- nova instance启动中的同步与异步
- 多线程下使用Jedis
- python中的字符串的种种函数
- java: file/outputStream/InputStream 复制文件
- 解决:phantomjs helloworld.js报错: Can&#39;t open &#39;helloworld.js&#39;
- iTerm2 + Oh My Zsh
- LeetCode OJ:Count Complete Tree Nodes(完全二叉树的节点数目)