值方图(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(); //如果不是刷新图像,有没有都可以
}
}
}
 

EmguCV3.0几个控件的使用的更多相关文章

  1. 与众不同 windows phone (34) - 8.0 新的控件: LongListSelector

    [源码下载] 与众不同 windows phone (34) - 8.0 新的控件: LongListSelector 作者:webabcd 介绍与众不同 windows phone 8.0 之 新的 ...

  2. UiAutomator2.0 - 获取同行控件

    目录 问题:UI测试时,在同一个界面出现相同的属性的控件(如图),对于这种控件的获取很是无奈.如果直接通过控件id去查找的话总是会返回界面该类型的第一个控件. 解决: 1.UiObject2 中已经给 ...

  3. VB6.0中WinSock控件属性和方法详解

    原文链接:http://liweibird.blog.51cto.com/631764/653134 WinSock控件能够通过UDP协议(用户数据报协议)或TCP协议(数据传输协议)连接到远程的机器 ...

  4. CefSharp.v49.0.1浏览器控件完全WPF版,实现禁止弹出新窗口,在同一窗口打开链接,并且支持带type="POST" target="_blank"的链接

    需求场景:在查询页面,填写查询条件,查询条件包括上传的图片,根据图片的特征查询,这就需要在提交的时候,使用POST提交,因为GET提交无法提交图片数据,提交查询条件之后,在新的窗口展示查询结果.(当然 ...

  5. Vue.2.0.5-表单控件绑定

    基础用法 你可以用 v-model 指令在表单控件元素上创建双向数据绑定.它会根据控件类型自动选取正确的方法来更新元素.尽管有些神奇,但 v-model 本质上不过是语法糖,它负责监听用户的输入事件以 ...

  6. andorid 控件 Bootstrap3.0风格的控件 精美UI控件库

    Bootstrap是Twitter推出的一个开源的用于前端开发的工具包.它由Twitter的设计师Mark Otto和Jacob Thornton合作开发,是一个CSS/HTML框架.Bootstra ...

  7. 解决Win7下VC6.0插入ActiveX控件对话框为空的问题

    在Win7环境下,编写MFC应用程序,Project菜单下Add To Project子菜单中的 Components and Controls…选项,在弹出的对话框中Gallery文件为空,也就无法 ...

  8. FineUI(专业版)v3.2.0 发布(ASP.NET UI控件库)!

    +2016-08-20 v3.2.0 +表格增强. +表格列RenderField增加属性ClientHtmlEncode,用于在客户端进行HTML编码. -增加示例:单元格编辑->杂项-> ...

  9. Android5.0新控件CardView的介绍和使用

       CardView也是5.0的新控件,这控件其实就是一个卡片啦,当然我们自己也完全可以定义这样一个卡片,从现在的微博等社App中可以看到各式各样的自定义卡片,所以这个控件意义不是很大.suppor ...

随机推荐

  1. nginxif多条件结合判断(实现限速)

    参考文章: https://yq.aliyun.com/articles/44957 需求: 要对某一ip下,使用android客户端的用户进行限速 原理 就是用SET变量进行. AND 就用变量叠加 ...

  2. keystone uwsgi failed

    ~$ /usr/local/bin/uwsgi /etc/keystone/keystone-uwsgi-public.ini[uWSGI] getting INI configuration fro ...

  3. C++的转换函数

    听侯捷老师的讲课笔记: 所谓转换函数指的是类型之间的转换,比如把自定义的类类型转换成内建类型(比如double),后者向相反的方向转. 直接上代码: 头文件conversion_function.h: ...

  4. 工程优化方法中的“最速下降法”和“DFP拟牛顿法”的 C 语言实现

    这个小程序是研一上学期的“工程优化”课程的大作业.其实这题本可以用 MATLAB 实现,但是我为了锻炼自己薄弱的编码能力,改为用 C 语言实现.这样,就得自己实现矩阵的运算(加减乘除.求逆.拷贝):难 ...

  5. The import javax.servlet.jsp.JspWriter cannot be resolved' error

    Add servlet-api.jar and jsp-api.jar from Tomcat 6.0 library to ecipse project.

  6. 51 nod 1091 贪心

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1091 1091 线段的重叠 基准时间限制:1 秒 空间限制:131072 ...

  7. dilworth定理的通俗讲解

    度娘定义:在数学理论中的序理论与组合数学中,Dilworth定理根据序列划分的最小数量的链描述了任何有限偏序集的宽度.其名称取自数学家Robert P. Dilworth. 反链是一种偏序集,其任意两 ...

  8. java web工程启动socket服务

    1.新建web工程 2.自定义类 实现ServletContextListener 接口 在contextInitialized方法中启动socket服务的线程 在contextDestroyed方法 ...

  9. Python Indentation

    In Python, code blocks don't have explicit begin/end or curly braces to mark beginning and end of th ...

  10. Flea

    It is known that fleas in Berland can jump only vertically and horizontally, and the length of the j ...