CrazyIter 4 jaren geleden
bovenliggende
commit
be9f80a13e
18 gewijzigde bestanden met toevoegingen van 1988 en 0 verwijderingen
  1. 10 0
      OpenCVTest/OpenCVTest.csproj
  2. BIN
      OpenCVTest/PyTorch官方教程中文版.pdf
  3. BIN
      OpenCVTest/opencv 4.1中文官方文档v1.1版.pdf
  4. 22 0
      OpenCVTest/简单图像处理软件/简单图像处理软件.sln
  5. 6 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/App.config
  6. 238 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Form1.Designer.cs
  7. 822 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Form1.cs
  8. 120 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Form1.resx
  9. 149 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Form2.Designer.cs
  10. 107 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Form2.cs
  11. 120 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Form2.resx
  12. 22 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Program.cs
  13. 36 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Properties/AssemblyInfo.cs
  14. 71 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Properties/Resources.Designer.cs
  15. 117 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Properties/Resources.resx
  16. 30 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Properties/Settings.Designer.cs
  17. 7 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/Properties/Settings.settings
  18. 111 0
      OpenCVTest/简单图像处理软件/简单图像处理软件/简单图像处理软件.csproj

+ 10 - 0
OpenCVTest/OpenCVTest.csproj

@@ -17,5 +17,15 @@
 
   <ItemGroup>
     <Folder Include="py\" />
+    <Folder Include="简单图像处理软件\.vs\简单图像处理软件\v16\" />
+    <Folder Include="简单图像处理软件\简单图像处理软件\obj\Debug\TempPE\" />
+  </ItemGroup>
+
+
+
+
+  <ItemGroup>
+    <None Include="简单图像处理软件\简单图像处理软件.sln" />
+    <None Include="简单图像处理软件\简单图像处理软件\简单图像处理软件.csproj" />
   </ItemGroup>
 </Project>

BIN
OpenCVTest/PyTorch官方教程中文版.pdf


BIN
OpenCVTest/opencv 4.1中文官方文档v1.1版.pdf


+ 22 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件.sln

@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.23107.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "简单图像处理软件", "简单图像处理软件\简单图像处理软件.csproj", "{56AB42D5-110C-47F0-96D4-72D5507F04F4}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{56AB42D5-110C-47F0-96D4-72D5507F04F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{56AB42D5-110C-47F0-96D4-72D5507F04F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{56AB42D5-110C-47F0-96D4-72D5507F04F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{56AB42D5-110C-47F0-96D4-72D5507F04F4}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 6 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
+    </startup>
+</configuration>

+ 238 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Form1.Designer.cs

@@ -0,0 +1,238 @@
+namespace 简单图像处理软件
+{
+    partial class Form1
+    {
+        /// <summary>
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows 窗体设计器生成的代码
+
+        /// <summary>
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.openBtn = new System.Windows.Forms.Button();
+            this.saveBtn = new System.Windows.Forms.Button();
+            this.initalBtn = new System.Windows.Forms.Button();
+            this.button1 = new System.Windows.Forms.Button();
+            this.reflashBtn = new System.Windows.Forms.Button();
+            this.listBox1 = new System.Windows.Forms.ListBox();
+            this.listBox2 = new System.Windows.Forms.ListBox();
+            this.pictureShow = new System.Windows.Forms.PictureBox();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.label2 = new System.Windows.Forms.Label();
+            this.button2 = new System.Windows.Forms.Button();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureShow)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // openBtn
+            // 
+            this.openBtn.AutoSize = true;
+            this.openBtn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.openBtn.ForeColor = System.Drawing.SystemColors.ControlText;
+            this.openBtn.Location = new System.Drawing.Point(26, 12);
+            this.openBtn.Name = "openBtn";
+            this.openBtn.Size = new System.Drawing.Size(94, 30);
+            this.openBtn.TabIndex = 0;
+            this.openBtn.Text = "打开图片";
+            this.openBtn.UseVisualStyleBackColor = true;
+            this.openBtn.Click += new System.EventHandler(this.openBtn_Click);
+            // 
+            // saveBtn
+            // 
+            this.saveBtn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.saveBtn.Location = new System.Drawing.Point(178, 12);
+            this.saveBtn.Name = "saveBtn";
+            this.saveBtn.Size = new System.Drawing.Size(92, 30);
+            this.saveBtn.TabIndex = 1;
+            this.saveBtn.Text = "保存图片";
+            this.saveBtn.UseVisualStyleBackColor = true;
+            this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
+            // 
+            // initalBtn
+            // 
+            this.initalBtn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.initalBtn.Location = new System.Drawing.Point(639, 12);
+            this.initalBtn.Name = "initalBtn";
+            this.initalBtn.Size = new System.Drawing.Size(96, 30);
+            this.initalBtn.TabIndex = 3;
+            this.initalBtn.Text = "初始化";
+            this.initalBtn.UseVisualStyleBackColor = true;
+            this.initalBtn.Click += new System.EventHandler(this.initalBtn_Click);
+            // 
+            // button1
+            // 
+            this.button1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.button1.Location = new System.Drawing.Point(482, 12);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(94, 29);
+            this.button1.TabIndex = 4;
+            this.button1.Text = "使用说明";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // reflashBtn
+            // 
+            this.reflashBtn.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.reflashBtn.Location = new System.Drawing.Point(328, 12);
+            this.reflashBtn.Name = "reflashBtn";
+            this.reflashBtn.Size = new System.Drawing.Size(92, 30);
+            this.reflashBtn.TabIndex = 5;
+            this.reflashBtn.Text = "刷新图像";
+            this.reflashBtn.UseVisualStyleBackColor = true;
+            this.reflashBtn.Click += new System.EventHandler(this.reflashBtn_Click);
+            // 
+            // listBox1
+            // 
+            this.listBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
+            this.listBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.listBox1.ForeColor = System.Drawing.SystemColors.WindowText;
+            this.listBox1.FormattingEnabled = true;
+            this.listBox1.ItemHeight = 21;
+            this.listBox1.Items.AddRange(new object[] {
+            "转化为灰度图",
+            "反色",
+            "图像二值化",
+            "高斯滤波",
+            "均值滤波",
+            "中值滤波",
+            "双边滤波",
+            "边缘检测(sobel)",
+            "边缘检测(scharr)",
+            "边缘检测(canny)",
+            "边缘检测(Laplacian)",
+            "浮雕效果",
+            "反转(左右)",
+            "反转(上下)",
+            "毛玻璃效果",
+            "锐化",
+            "膨胀",
+            "腐蚀",
+            "顶帽",
+            "黑帽",
+            "gamma暗部增强",
+            "log亮部增强",
+            "显示直方图",
+            "轮廓绘制",
+            "模板匹配",
+            "绘制轮廓图"});
+            this.listBox1.Location = new System.Drawing.Point(0, 66);
+            this.listBox1.Name = "listBox1";
+            this.listBox1.ScrollAlwaysVisible = true;
+            this.listBox1.Size = new System.Drawing.Size(160, 571);
+            this.listBox1.TabIndex = 6;
+            this.listBox1.DoubleClick += new System.EventHandler(this.listBox1_DoubleClick);
+            // 
+            // listBox2
+            // 
+            this.listBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
+            this.listBox2.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.listBox2.FormattingEnabled = true;
+            this.listBox2.ItemHeight = 25;
+            this.listBox2.Location = new System.Drawing.Point(979, 66);
+            this.listBox2.Name = "listBox2";
+            this.listBox2.ScrollAlwaysVisible = true;
+            this.listBox2.Size = new System.Drawing.Size(188, 579);
+            this.listBox2.TabIndex = 7;
+            // 
+            // pictureShow
+            // 
+            this.pictureShow.Location = new System.Drawing.Point(166, 66);
+            this.pictureShow.Name = "pictureShow";
+            this.pictureShow.Size = new System.Drawing.Size(807, 514);
+            this.pictureShow.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+            this.pictureShow.TabIndex = 8;
+            this.pictureShow.TabStop = false;
+            // 
+            // textBox1
+            // 
+            this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
+            this.textBox1.Location = new System.Drawing.Point(166, 586);
+            this.textBox1.Multiline = true;
+            this.textBox1.Name = "textBox1";
+            this.textBox1.ReadOnly = true;
+            this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+            this.textBox1.Size = new System.Drawing.Size(807, 59);
+            this.textBox1.TabIndex = 9;
+            this.textBox1.Text = "以下为通知信息:\r\n";
+            this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.Location = new System.Drawing.Point(974, 36);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(172, 27);
+            this.label2.TabIndex = 11;
+            this.label2.Text = "已进行处理操作:";
+            // 
+            // button2
+            // 
+            this.button2.Location = new System.Drawing.Point(793, 13);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(85, 31);
+            this.button2.TabIndex = 12;
+            this.button2.Text = "打开窗口二";
+            this.button2.UseVisualStyleBackColor = true;
+            this.button2.Click += new System.EventHandler(this.button2_Click);
+            // 
+            // Form1
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+            this.ClientSize = new System.Drawing.Size(1172, 648);
+            this.Controls.Add(this.button2);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.textBox1);
+            this.Controls.Add(this.pictureShow);
+            this.Controls.Add(this.listBox2);
+            this.Controls.Add(this.listBox1);
+            this.Controls.Add(this.reflashBtn);
+            this.Controls.Add(this.button1);
+            this.Controls.Add(this.initalBtn);
+            this.Controls.Add(this.saveBtn);
+            this.Controls.Add(this.openBtn);
+            this.Name = "Form1";
+            this.Text = "简单小程序";
+            this.Load += new System.EventHandler(this.intrudBtn_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.pictureShow)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button openBtn;
+        private System.Windows.Forms.Button saveBtn;
+        private System.Windows.Forms.Button initalBtn;
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button reflashBtn;
+        private System.Windows.Forms.ListBox listBox1;
+        private System.Windows.Forms.ListBox listBox2;
+        private System.Windows.Forms.PictureBox pictureShow;
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Button button2;
+    }
+}
+

+ 822 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Form1.cs

@@ -0,0 +1,822 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using OpenCvSharp;
+using OpenCvSharp.Extensions;
+using System.Threading;
+
+namespace 简单图像处理软件
+{
+    public partial class Form1 : Form
+    {
+        public Form1()
+        {
+            InitializeComponent();
+        }
+
+        private void intrudBtn_Load(object sender, EventArgs e)
+        {
+            
+        }
+       
+        public Mat pictureMain;//当前主窗体图像
+        public Mat form2image;//窗体二图像
+        public float form2Num1=50f;
+        public float form2Num2 = 150f;//接受窗体二传入的参数一参数二
+        string imageName;
+        private void openBtn_Click(object sender, EventArgs e)
+        {
+            OpenFileDialog ofd1 = new OpenFileDialog();//创建打开文件夹窗体
+            ofd1.Title = "请选择输入的图像";
+            ofd1.InitialDirectory = @"";//初始化目录
+            ofd1.Multiselect = false;//不可多选
+            ofd1.Filter = "图像文件|*.jpg;*.png;*.bmp|全部文件|*.*";
+            ofd1.ShowDialog();
+
+            if (ofd1.FileName!=string.Empty)
+            {
+                try
+                {
+                    pictureShow.Load(ofd1.FileName);
+                    imageName = ofd1.FileName;
+                    textBox1.AppendText("\n\r打开文件:" + imageName);
+                    textBox1.SelectionStart = this.textBox1.TextLength;
+                    textBox1.ScrollToCaret();
+                    pictureMain = new Mat(ofd1.FileName);
+                }
+                catch (Exception)
+                {
+                    MessageBox.Show("打开失败,请检查文件格式是否符合");
+                }
+                
+            }
+
+        }
+        
+        private void saveBtn_Click(object sender, EventArgs e)
+        {
+            
+            if (pictureShow!=null)
+            {
+                SaveFileDialog sfd = new SaveFileDialog();
+                sfd.Title = "保存文件";
+                sfd.Filter = "JPGE图像|*.jpg|PNG图像|*.png|BMP图像|*.bmp|所有文件|*.*";
+                sfd.InitialDirectory = Environment.CurrentDirectory;
+                sfd.ShowDialog();
+                if (sfd.FileName != null)
+                {
+                    try
+                    {
+                        pictureShow.Image.Save(sfd.FileName);
+                        textBox1.AppendText("\r\n图片已保存至:" + sfd.FileName);
+                        textBox1.SelectionStart = textBox1.TextLength;
+                        textBox1.ScrollToCaret();
+                    }
+                    catch (Exception)
+                    {
+                    }
+                }
+            }
+            else
+            {
+                MessageBox.Show("无可保存图片");
+            }
+
+        }
+
+        private void textBox1_TextChanged(object sender, EventArgs e)
+        {
+
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+           // MessageBox.Show("本人第一个以C#和opencvsharp写的小程序,很多bug来不及慢慢优化,但也算包含一番心血,主要是将之前学习的内容再复习深化了解,感叹路漫漫其修远兮,昨日之日不可留,最终走回程序员这条路");
+        }
+        private void reflashBtn_Click(object sender, EventArgs e)
+        {
+            num = 1;
+            listBox2.Items.Clear();
+            textBox1.Text = "以下为通知信息:";
+            if (imageName != string.Empty)
+            {
+                try
+                {
+                    pictureShow.Load(imageName);
+                    pictureMain = new Mat(imageName);
+                    pictureShow.Image = pictureMain.ToBitmap();
+                }
+                catch { }
+                }
+
+        }
+        int num = 1;//记录处理次数
+        public  enum lb1_list//记录操作方法
+        {
+            gray,
+            reverse,
+            binary,
+            gaussianBlur,
+            blur,
+            medianBlur,
+            bilateralFilter,
+            sobel,
+            scharr,
+            canny,
+            Laplacian,
+            carve,
+            rever_lr,
+            rever_tb,
+            frost,
+            sharp,
+            dilate,
+            erode,
+            tophat,
+            blackhat,
+            gamma,
+            log,
+            hist,
+            findContours,
+            template,
+            drawRect,
+
+        }
+        public int selectIndex;
+        /// <summary>
+        /// 实现双击启动处理
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void listBox1_DoubleClick(object sender, EventArgs e)
+        {
+            selectIndex = listBox1.SelectedIndex;
+            handle(selectIndex);
+        }
+        
+        
+
+        /// <summary>
+        /// 二值化Tbar处理函数
+        /// </summary>
+        /// <param name="pos"></param>
+        /// <param name="userdata"></param>
+        public void binary(int pos, object userdata)
+        {
+
+            Mat a = (Mat)userdata;
+            Mat b = new Mat();
+            a.CopyTo(b);
+            Cv2.Threshold(b, b, pos * 25, 255, ThresholdTypes.Binary);
+            Cv2.ImShow("二值化处理", b);
+            b.CopyTo(pictureMain);
+            pictureShow.Image = pictureMain.ToBitmap();
+            b.Release();
+        }
+        
+        /// <summary>
+        /// 高斯滤波
+        /// </summary>
+        /// <param name="pos"></param>
+        /// <param name="userdata"></param>
+        public void gaussianBlur(int pos,object userdata)
+        {
+            Mat src = (Mat)userdata;
+            Mat a = new Mat();
+            src.CopyTo(a);
+
+            Cv2.GaussianBlur(a, a, new OpenCvSharp.Size(pos*2+1, pos*2+1), 5);
+
+            Cv2.ImShow("高斯滤波", a);
+            a.CopyTo(pictureMain);
+            pictureShow.Image = a.ToBitmap();
+            a.Release();
+        }
+        /// <summary>
+        /// 均值滤波
+        /// </summary>
+        /// <param name="pos"></param>
+        /// <param name="userdata"></param>
+        public  void blur(int pos,object userdata)
+        {
+            Mat src = (Mat)userdata;
+            Mat a = new Mat();
+            src.CopyTo(a);
+
+            Cv2.Blur(a, a, new OpenCvSharp.Size(pos+1, pos+1));
+
+            Cv2.ImShow("均值滤波", a);
+            a.CopyTo(pictureMain);
+            pictureShow.Image = a.ToBitmap();
+            a.Release();
+        }
+
+        public void medianBlur(int pos, object userdata)
+        {
+            Mat src = (Mat)userdata;
+            Mat a = new Mat();
+            src.CopyTo(a);
+            Cv2.MedianBlur(a, a, pos*2+1);
+            Cv2.ImShow("中值滤波", a);
+            a.CopyTo(pictureMain);
+            pictureShow.Image = a.ToBitmap();
+            a.Release();
+        }
+        public void bilateralFilter(int pos, object userdata)
+        {
+            
+            Mat src = (Mat)userdata;
+            Mat a = new Mat();
+            Mat b = new Mat();
+            src.CopyTo(b);
+            Cv2.BilateralFilter(b, a, pos*5 + 1, 100, 100);
+            Cv2.ImShow("双边滤波", a);
+            a.CopyTo(pictureMain);
+            pictureShow.Image = a.ToBitmap();
+            a.Release();
+            b.Release();
+        }
+        public void canny(int pos,object userdata)
+        {
+            Mat src = (Mat)userdata;
+            Mat a = new Mat();
+            src.CopyTo(a);
+            Cv2.Canny(a, a, pos * 25, pos * 25);
+            Cv2.ImShow("canny边缘检测", a);
+            a.CopyTo(pictureMain);
+            pictureShow.Image = a.ToBitmap();
+            a.Release();
+            Thread.Sleep(50);
+        }
+        public void laplacian(int pos,object userdata)
+        {
+            Mat src=(Mat)userdata;
+            Mat a = new Mat();
+            src.CopyTo(a);
+            Cv2.Laplacian(a, a, -1, pos*2 + 1);
+            Cv2.ImShow("Laplacian边缘检测", a);
+            a.CopyTo(pictureMain);
+            pictureShow.Image = a.ToBitmap();
+            a.Release();
+        }
+        public void dilate(int pos,object userdata)
+        {
+            Mat src = (Mat)userdata;
+            Mat a = new Mat();
+            src.CopyTo(a);
+            Mat structureElement = Cv2.GetStructuringElement(MorphShapes.Rect, new OpenCvSharp.Size(pos * 2 + 1, pos * 2 + 1));
+            Cv2.Dilate(a, a, structureElement);
+            Cv2.ImShow("膨胀处理", a);
+            a.CopyTo(pictureMain);
+            pictureShow.Image = a.ToBitmap();
+            a.Release();
+        }
+        public void erode(int pos,object userdata)
+        {
+            Mat src = (Mat)userdata;
+            Mat a = new Mat();
+            src.CopyTo(a);
+            Mat structureElement = Cv2.GetStructuringElement(MorphShapes.Rect, new OpenCvSharp.Size(pos * 2 + 1, pos * 2 + 1));
+            Cv2.Erode(a, a, structureElement);
+            Cv2.ImShow("腐蚀处理", a);
+            a.CopyTo(pictureMain);
+            pictureShow.Image = a.ToBitmap();
+            a.Release();
+        }
+        public void tophat(int pos,object userdata)
+        {
+            Mat src = (Mat)userdata;
+            Mat a = new Mat();
+            src.CopyTo(a);
+            Mat stuctureElement = Cv2.GetStructuringElement(MorphShapes.Rect, new OpenCvSharp.Size(pos+1, pos+1), new OpenCvSharp.Point(-1, -1));
+            Cv2.MorphologyEx(a, a, MorphTypes.TopHat, stuctureElement);
+            Cv2.ImShow("顶帽处理", a);
+            a.CopyTo(pictureMain);
+            pictureShow.Image = pictureMain.ToBitmap();
+            a.Release();
+        }
+        public void blackhat(int pos, object userdata)
+        {
+            Mat src = (Mat)userdata;
+            Mat a = new Mat();
+            src.CopyTo(a);
+            Mat stuctureElement = Cv2.GetStructuringElement(MorphShapes.Rect, new OpenCvSharp.Size(pos + 1, pos + 1), new OpenCvSharp.Point(-1, -1));
+            Cv2.MorphologyEx(a, a, MorphTypes.BlackHat, stuctureElement);
+            Cv2.ImShow("黑帽处理", a);
+            a.CopyTo(pictureMain);
+            pictureShow.Image = pictureMain.ToBitmap();
+            a.Release();
+        }
+        public void drawRect(int pos,object userdata)
+        {
+            Mat src = (Mat)userdata;
+            Mat a = new Mat();
+            Mat gray = new Mat();
+            src.CopyTo(gray);
+            if (gray.Channels()==3)
+            {
+                Cv2.CvtColor(gray, gray, ColorConversionCodes.BGR2GRAY);
+            }
+            gray.CopyTo(a);
+            Cv2.Threshold(~a, a ,pos *25, 255, ThresholdTypes.Binary);
+            //Cv2.Canny(a, a, pos*10, 255);
+            HierarchyIndex[] hierarchy;
+            OpenCvSharp.Point[][] coutours;
+            Cv2.FindContours(a, out coutours,out hierarchy, RetrievalModes.External, ContourApproximationModes.ApproxNone);
+            OpenCvSharp.Point[][] contours_ploy = new OpenCvSharp.Point[coutours.Length][];
+            RotatedRect[] RotatedRect_ploy = new RotatedRect[coutours.Length];
+            Rect[] rect_poly = new Rect[coutours.Length];
+            for (int i = 0; i < coutours.Length; i++)
+            {
+                contours_ploy[i] = Cv2.ApproxPolyDP(coutours[i], 10, true);//计算凸包
+                rect_poly[i] = Cv2.BoundingRect(coutours[i]);//最小外接矩形,我们不用,
+                if (contours_ploy[i].Length>5)//拟合的线条数不少于5
+                {
+                    RotatedRect temp1 = Cv2.MinAreaRect(contours_ploy[i]);//最小外接矩形,能旋转
+                    RotatedRect_ploy[i] = temp1;//将该矩形放入集合中
+                }
+            }
+            Point2f[] pot = new Point2f[4];
+            for (int i = 0; i < RotatedRect_ploy.Length; i++)
+            {
+                pot = RotatedRect_ploy[i].Points();
+                double line1 = Math.Sqrt((pot[1].Y - pot[0].Y) * (pot[1].Y - pot[0].Y)+ (pot[1].X - pot[0].X) * (pot[1].X - pot[0].X));
+                double line2=Math.Sqrt((pot[3].Y - pot[0].Y) * (pot[3].Y - pot[0].Y) + (pot[3].X - pot[0].X) * (pot[3].X - pot[0].X));
+                if (line1*line2<9000)//太小直接pass
+                {
+                    continue;
+                }
+
+                for (int j = 0; j < 4; j++)
+                {
+                    Cv2.Line(pictureMain, (OpenCvSharp.Point)pot[j], (OpenCvSharp.Point)pot[(j + 1) % 4], Scalar.Green,3);
+                }
+            }
+            Cv2.ImShow("最小外包矩形", a);
+            pictureShow.Image = pictureMain.ToBitmap();
+            a.Release();
+        }
+        public void handle(int selectIndex)
+        {
+
+            switch (selectIndex)
+            {
+                case (int)lb1_list.gray:
+                    if (pictureMain.Channels() == 3)
+                    {
+                        Cv2.CvtColor(pictureMain, pictureMain, ColorConversionCodes.BGR2GRAY);
+                        pictureShow.Image = pictureMain.ToBitmap();
+                        display("灰度化");
+                    }
+                    else
+                    {
+                        MessageBox.Show("已是灰度图像,不要重复操作");
+                    }
+                    break;
+                case (int)lb1_list.reverse:
+                    pictureMain = ~pictureMain;
+                    pictureShow.Image = pictureMain.ToBitmap();
+                    display("反色");
+                    break;
+                case (int)lb1_list.binary:
+                    Cv2.ImShow("二值化处理", pictureMain);
+                    Mat temp0 = new Mat();
+                    pictureMain.CopyTo(temp0);
+                    CvTrackbarCallback2 ctbc0 = new CvTrackbarCallback2(binary);
+                    CvTrackbar cvtb0 = new CvTrackbar("程度", "二值化处理", 0, 10, ctbc0, temp0);
+                    display("二值化");
+                    break;
+
+                case (int)lb1_list.gaussianBlur:
+                    Cv2.ImShow("高斯滤波", pictureMain);
+                    Mat temp1 = new Mat();
+                    pictureMain.CopyTo(temp1);
+
+                    CvTrackbarCallback2 ctbc1 = new CvTrackbarCallback2(gaussianBlur);
+                    CvTrackbar cvtb1 = new CvTrackbar("程度", "高斯滤波", 0, 10, ctbc1, temp1);
+
+                    display("高斯滤波");
+                    break;
+                case (int)lb1_list.blur:
+                    Cv2.ImShow("均值滤波", pictureMain);
+                    Mat temp2 = new Mat();
+                    pictureMain.CopyTo(temp2);
+
+                    CvTrackbarCallback2 ctbc2 = new CvTrackbarCallback2(blur);
+                    CvTrackbar cvtb2 = new CvTrackbar("程度", "均值滤波", 0, 10, ctbc2, temp2);
+
+                    display("均值滤波");
+                    break;
+                case (int)lb1_list.medianBlur:
+                    Cv2.ImShow("中值滤波", pictureMain);
+                    Mat temp3 = new Mat();
+                    pictureMain.CopyTo(temp3);
+
+                    CvTrackbarCallback2 ctbc3 = new CvTrackbarCallback2(medianBlur);
+                    CvTrackbar cvtb3 = new CvTrackbar("程度", "中值滤波", 0, 10, ctbc3, temp3);
+
+                    display("中值滤波");
+                    break;
+                case (int)lb1_list.bilateralFilter:
+                    Cv2.ImShow("双边滤波", pictureMain);
+                    Mat temp4 = new Mat();
+                    pictureMain.CopyTo(temp4);
+
+                    CvTrackbarCallback2 crbc4 = new CvTrackbarCallback2(bilateralFilter);
+                    CvTrackbar cvtb4 = new CvTrackbar("程度", "双边滤波", 0, 10, crbc4, temp4);
+
+                    display("双边滤波");
+                    break;
+                case (int)lb1_list.sobel://-1 -2  -1
+                    Mat sobelx = new Mat();
+                    Mat sobely = new Mat();
+                    Cv2.Sobel(pictureMain, sobelx, -1, 1, 0);
+                    Cv2.Sobel(pictureMain, sobely, -1, 0, 1);
+                    Cv2.AddWeighted(sobelx, 0.5, sobely, 0.5, 0, pictureMain);//gamma为加到结果上的值
+                    pictureShow.Image = pictureMain.ToBitmap();
+                    display("sobel边缘检测");
+                    break;
+                case (int)lb1_list.scharr://-3   -10  -3
+                    Mat scharrx = new Mat();
+                    Mat scharry = new Mat();
+                    Cv2.Scharr(pictureMain, scharrx, -1, 1, 0);
+                    Cv2.Scharr(pictureMain, scharry, -1, 0, 1);
+                    Cv2.AddWeighted(scharrx, 0.5, scharry, 0.5, 0, pictureMain);
+                    pictureShow.Image = pictureMain.ToBitmap();
+                    display("scharr边缘检测");
+                    break;
+                case (int)lb1_list.canny:
+                    Cv2.ImShow("canny边缘检测", pictureMain);
+                    Mat temp_canny = new Mat();
+                    pictureMain.CopyTo(temp_canny);
+                    if (temp_canny.Channels() == 3)
+                    {
+                        Cv2.CvtColor(temp_canny, temp_canny, ColorConversionCodes.BGR2GRAY);
+                    }
+                    CvTrackbarCallback2 ctbc_canny = new CvTrackbarCallback2(canny);
+                    CvTrackbar cvtb_canny = new CvTrackbar("程度", "canny边缘检测", 0, 10, ctbc_canny, temp_canny);
+                    display("canny边缘检测");
+                    break;
+                case (int)lb1_list.Laplacian:
+                    Cv2.ImShow("Laplacian边缘检测", pictureMain);
+                    Mat temp_Laplacian = new Mat();
+                    pictureMain.CopyTo(temp_Laplacian);
+                    CvTrackbarCallback2 ctbc_Laplacian = new CvTrackbarCallback2(laplacian);
+                    CvTrackbar cvrb_laplacian = new CvTrackbar("程度", "Laplacian边缘检测", 0, 10, ctbc_Laplacian, temp_Laplacian);
+                    display("laplacian边缘检测");
+                    break;
+                case (int)lb1_list.carve:
+                    if (pictureMain.Channels() != 1)
+                    {
+                        Cv2.CvtColor(pictureMain, pictureMain, ColorConversionCodes.BGR2GRAY);
+                    }
+
+                    for (int i = 0; i < pictureMain.Rows; i++)
+                    {
+                        for (int j = 0; j < pictureMain.Cols; j++)
+                        {
+                            int newP = 2 * pictureMain.Get<byte>(i, j) - pictureMain.Get<byte>(i, j + 1) - pictureMain.Get<byte>(i + 1, j)+100 ;
+
+                            if (newP > 255)
+                            {
+                                newP = 255;
+                            }
+                            else if (newP < 0)
+                            {
+                                newP = 0;
+                            }
+                            pictureMain.Set(i, j, (byte)newP);
+                        }
+                    }
+                    pictureShow.Image = pictureMain.ToBitmap();
+                    display("浮雕");
+                    break;
+                case (int)lb1_list.rever_lr:
+                    Mat imx_lr = new Mat(pictureMain.Size(), MatType.CV_32FC1);
+                    Mat imy_lr = new Mat(pictureMain.Size(), MatType.CV_32FC1);
+                    for (int i = 0; i < pictureMain.Rows; i++)
+                    {
+                        for (int j = 0; j < pictureMain.Cols; j++)
+                        {
+                            imx_lr.Set(i, j, (float)(pictureMain.Cols - j - 1));
+                            imy_lr.Set(i, j, (float)i);
+                        }
+                    }
+                    Cv2.Remap(pictureMain, pictureMain, imx_lr, imy_lr);
+                    pictureShow.Image = pictureMain.ToBitmap();
+                    display("左右反转");
+                    break;
+                case (int)lb1_list.rever_tb:
+                    Mat imx_tb = new Mat(pictureMain.Size(), MatType.CV_32FC1);
+                    Mat imy_tb = new Mat(pictureMain.Size(), MatType.CV_32FC1);
+                    for (int i = 0; i < pictureMain.Rows; i++)
+                    {
+                        for (int j = 0; j < pictureMain.Cols; j++)
+                        {
+                            imx_tb.Set(i, j, (float)j);
+                            imy_tb.Set(i, j, (float)(pictureMain.Rows - i - 1));
+                        }
+                    }
+                    Cv2.Remap(pictureMain, pictureMain, imx_tb, imy_tb);
+                    pictureShow.Image = pictureMain.ToBitmap();
+                    display("上下反转");
+                    break;
+                case (int)lb1_list.frost:
+                    Mat imx_frost = new Mat(pictureMain.Size(), MatType.CV_32FC1);
+                    Mat imy_frost = new Mat(pictureMain.Size(), MatType.CV_32FC1);
+                    Random rm = new Random();
+                    for (int i = 0; i < pictureMain.Rows; i++)
+                    {
+                        for (int j = 0; j < pictureMain.Cols; j++)
+                        {
+                            imx_frost.Set(i, j, (float)(j + rm.Next(-5, 5)));
+                            imy_frost.Set(i, j, (float)(i + rm.Next(-5, 5)));
+                        }
+                    }
+                    Cv2.Remap(pictureMain, pictureMain, imx_frost, imy_frost);
+                    pictureShow.Image = pictureMain.ToBitmap();
+                    display("毛玻璃");
+                    break;
+                case (int)lb1_list.sharp:
+                    Mat mask = new Mat(new OpenCvSharp.Size(3, 3), MatType.CV_32FC1);
+                    mask.Set<float>(0, 1, -1); mask.Set<float>(1, 0, -1); mask.Set<float>(1, 1, 5); mask.Set<float>(1, 2, -1); mask.Set<float>(2, 1, -1);
+                    Mat temp_sharp = new Mat();
+                    pictureMain.CopyTo(temp_sharp);
+                    Cv2.Filter2D(pictureMain, temp_sharp, -1, mask);
+                    Cv2.WaitKey(500);
+                    temp_sharp.CopyTo(pictureMain);
+                    pictureShow.Image = temp_sharp.ToBitmap();
+                    display("锐化");
+                    mask.Release();
+                    temp_sharp.Release();
+                    break;
+                case (int)lb1_list.dilate:
+                    Cv2.ImShow("膨胀处理", pictureMain);
+                    Mat temp_dilate = new Mat();
+                    pictureMain.CopyTo(temp_dilate);
+                    CvTrackbarCallback2 ctbc_dilate = new CvTrackbarCallback2(dilate);
+                    CvTrackbar cvtb_dilate = new CvTrackbar("程度", "膨胀处理", 0, 10, ctbc_dilate, temp_dilate);
+                    display("膨胀");
+                    break;
+                case (int)lb1_list.erode:
+                    Cv2.ImShow("腐蚀处理", pictureMain);
+                    Mat temp_erode = new Mat();
+                    pictureMain.CopyTo(temp_erode);
+                    CvTrackbarCallback2 ctbc_erode = new CvTrackbarCallback2(erode);
+                    CvTrackbar cvtb_erode = new CvTrackbar("程度", "腐蚀处理", 0, 10, ctbc_erode, temp_erode);
+                    display("腐蚀");
+                    break;
+                case (int)lb1_list.gamma:
+                    if (pictureMain.Channels() == 1)
+                    {
+                        Mat temp_gray = new Mat(pictureMain.Size(), MatType.CV_16UC1);
+                        for (int i = 0; i < pictureMain.Rows; i++)
+                        {
+                            for (int j = 0; j < pictureMain.Cols; j++)
+                            {
+                                temp_gray.Set(i, j, Math.Abs(pictureMain.Get<byte>(i, j) * pictureMain.Get<byte>(i, j)));//因为pictureMain为8UC1,所以这里一定要使用<byte>,不能使用其他类型
+                            }
+                        }
+                        Cv2.Normalize(temp_gray, temp_gray, 0, 255, NormTypes.MinMax);
+                        Cv2.ConvertScaleAbs(temp_gray, temp_gray);
+                        temp_gray.CopyTo(pictureMain);
+                        pictureShow.Image = pictureMain.ToBitmap();
+                        temp_gray.Release();
+                    }
+                    else
+                    {
+                        Mat temp_gamma = new Mat(pictureMain.Size(), MatType.CV_32FC3);
+                        Vec3f channels = new Vec3f();
+                        for (int i = 0; i < pictureMain.Rows; i++)
+                        {
+                            for (int j = 0; j < pictureMain.Cols; j++)
+                            {
+                                channels.Item0 = Math.Abs(pictureMain.Get<Vec3b>(i, j).Item0 * pictureMain.Get<Vec3b>(i, j).Item0);
+                                channels.Item1 = Math.Abs(pictureMain.Get<Vec3b>(i, j).Item1 * pictureMain.Get<Vec3b>(i, j).Item1);
+                                channels.Item2 = Math.Abs(pictureMain.Get<Vec3b>(i, j).Item2 * pictureMain.Get<Vec3b>(i, j).Item2);
+                                temp_gamma.Set(i, j, channels);
+                            }
+                        }
+                        Cv2.Normalize(temp_gamma, temp_gamma, 0, 255, NormTypes.MinMax);
+                        Cv2.ConvertScaleAbs(temp_gamma, temp_gamma);
+                        temp_gamma.CopyTo(pictureMain);
+                        pictureShow.Image = pictureMain.ToBitmap();
+                        temp_gamma.Release();
+                    }
+                    display("gamma调整");
+                    break;
+                case (int)lb1_list.log:
+                    Mat[] temp_log = pictureMain.Split();
+                    for (int i = 0; i < pictureMain.Rows; i++)
+                    {
+                        for (int j = 0; j < pictureMain.Cols; j++)
+                        {
+                            temp_log[0].Set(i, j, Math.Log(temp_log[0].Get<float>(i, j), 1.2));
+                            temp_log[1].Set(i, j, Math.Log(temp_log[1].Get<float>(i, j), 1.2));
+                            temp_log[2].Set(i, j, Math.Log(temp_log[2].Get<float>(i, j), 1.2));
+                        }
+                    }
+                    Cv2.Merge(temp_log, pictureMain);
+                    Cv2.Normalize(pictureMain, pictureMain, 0, 255, NormTypes.MinMax);
+                    pictureShow.Image = pictureMain.ToBitmap();
+
+                    //Mat temp_log = new Mat(pictureMain.Size(), MatType.CV_8UC3);
+                    //pictureMain.CopyTo(temp_log);
+                    //if (pictureMain.Channels()==3)
+                    //{
+                    //    Vec3i channels = new Vec3i();
+                    //    for (int i = 0; i < pictureMain.Rows; i++)
+                    //    {
+                    //        for (int j = 0; j < pictureMain.Cols; j++)
+                    //        {
+                    //            //float a = pictureMain.Get<Vec3b>(i, j).Item0;
+                    //            //float b = pictureMain.Get<Vec3b>(i, j).Item1;
+                    //            //float c = pictureMain.Get<Vec3b>(i, j).Item2;
+                    //            channels.Item0 = (int)Math.Log(pictureMain.Get<Vec3b>(i, j).Item0,1.2);
+                    //            channels.Item1 = (int)Math.Log(pictureMain.Get<Vec3b>(i, j).Item1,1.2);
+                    //            channels.Item2 = (int)Math.Log(pictureMain.Get<Vec3b>(i, j).Item2,1.2);
+                    //            temp_log.Set<Vec3i>(i, j, channels);
+                    //        }
+                    //    }//这个操作有毒,不能归一化,还把GR通道置0,放弃
+                    //temp_log.Normalize(255,0, NormTypes.MinMax);
+                    //float e1 = temp_log.Get<Vec3b>(0,0).Item0;
+                    //float f = temp_log.Get<Vec3b>(0,0).Item1;
+                    //float g = temp_log.Get<Vec3b>(0, 0).Item2;
+                    //Cv2.Normalize(temp_log, temp_log, 0, 255, NormTypes.MinMax);
+                    //Cv2.ConvertScaleAbs(temp_log, temp_log);
+                    //temp_log.CopyTo(pictureMain);
+                    //pictureShow.Image = pictureMain.ToBitmap();
+                    //temp_log.Release();
+
+                    display("log亮部增强");
+                    break;
+                case (int)lb1_list.tophat:
+                    Mat temp_tophat = new Mat();
+                    pictureMain.CopyTo(temp_tophat);
+                    Cv2.ImShow("顶帽处理", pictureMain);
+                    CvTrackbarCallback2 ctbc_topat = new CvTrackbarCallback2(tophat);
+                    CvTrackbar cvtb_tophat = new CvTrackbar("程度", "顶帽处理", 0, 20, ctbc_topat, temp_tophat);
+                    pictureShow.Image = pictureMain.ToBitmap();
+                    display("顶帽");
+                    break;
+                case (int)lb1_list.blackhat:
+                    Mat temp_blackhat = new Mat();
+                    pictureMain.CopyTo(temp_blackhat);
+                    Cv2.ImShow("黑帽处理", pictureMain);
+                    CvTrackbarCallback2 ctbc_blackhat = new CvTrackbarCallback2(blackhat);
+                    CvTrackbar cvtb_blackhat = new CvTrackbar("程度", "黑帽处理", 0, 20, ctbc_blackhat, temp_blackhat);
+                    pictureShow.Image = pictureMain.ToBitmap();
+                    display("黑帽");
+                    break;
+                case (int)lb1_list.hist:
+                    if (pictureMain.Channels() == 1)
+                    {
+                        Mat[] image = { pictureMain };
+                        Mat temp_hist = pictureMain;
+                        int[] channels = new int[] { 0 };
+                        int[] histsize = new int[] { 256 };
+                        Mat mask_hist = new Mat();
+                        Mat hist = new Mat();
+                        Rangef[] range = new Rangef[1];
+                        range[0].Start = 0f;
+                        range[0].End = 256f;
+                        Cv2.CalcHist(image, channels, mask_hist, hist, 1, histsize, range);
+                        Mat histImage = new Mat(256, 256, MatType.CV_8UC3);
+                        double minValue, maxValue;
+                        Cv2.MinMaxLoc(hist, out minValue, out maxValue);
+                        for (int i = 0; i < 256; i++)
+                        {
+                            int len = (int)(hist.Get<float>(i) / maxValue * 256);
+                            Cv2.Line(histImage, i, histImage.Rows, i, histImage.Rows - len, Scalar.White, 2);
+                        }
+                        Cv2.ImShow("灰度图像直方图", histImage);
+                    }
+                    else
+                    {
+                        Mat[] images = pictureMain.Split();
+                        Mat[] bImage = { images[0] };
+                        Mat[] gImage = { images[1] };
+                        Mat[] rImage = { images[2] };
+
+                        Mat mask_hist = new Mat();
+                        Mat[] hists = { new Mat(), new Mat(), new Mat() };
+                        int[] channels = { 0 };
+                        int[] histSize = { 256 };
+                        Rangef[] range = new Rangef[1];
+                        range[0].Start = 0f;
+                        range[0].End = 256f;
+                        Cv2.CalcHist(bImage, channels, mask_hist, hists[0], 1, histSize, range);//dim为需要统计直方图通道的个数
+                        Cv2.CalcHist(gImage, channels, mask_hist, hists[1], 1, histSize, range);
+                        Cv2.CalcHist(rImage, channels, mask_hist, hists[2], 1, histSize, range);
+
+                        Mat[] histImage = { new Mat(256, 256, MatType.CV_8UC3), new Mat(256, 256, MatType.CV_8UC3), new Mat(256, 256, MatType.CV_8UC3) };
+                        Scalar[] color = { Scalar.Blue, Scalar.Green, Scalar.Red };
+                        for (int i = 0; i < 3; i++)
+                        {
+                            double minVal = 0f;
+                            double maxVal = 0f;
+                            Cv2.MinMaxLoc(hists[i], out minVal, out maxVal);
+                            for (int j = 0; j < 256; j++)
+                            {
+                                int len = (int)(hists[i].Get<float>(j) / maxVal * 256);
+                                Cv2.Line(histImage[i], j, histImage[0].Rows, j, histImage[0].Rows - len, color[i], 2);
+                            }
+                        }
+                        Cv2.ImShow("b", histImage[0]);
+                        Cv2.ImShow("g", histImage[1]);
+                        Cv2.ImShow("r", histImage[2]);
+                    }
+                    display("直方图显示");
+                    break;
+                case (int)lb1_list.findContours:
+                    MessageBox.Show("假如卡死了,是计算量太大的缘故,请重新调整canny参数一参数二,默认参数一50,参数二150");
+                    Mat temp_find = new Mat();
+                    if (pictureMain.Channels() == 3)
+                    {
+                        Cv2.CvtColor(pictureMain, temp_find, ColorConversionCodes.BGR2GRAY);
+                    }
+
+
+                    Cv2.Canny(temp_find, temp_find, form2Num1, form2Num2);
+
+                    HierarchyIndex[] hierarchy;
+                    OpenCvSharp.Point[][] coutours;
+                    Cv2.FindContours(temp_find, out coutours, out hierarchy, RetrievalModes.List, ContourApproximationModes.ApproxNone);
+                    for (int i = 0; i < coutours.Length; i++)
+                    {
+                        Cv2.DrawContours(pictureMain, coutours, i, Scalar.RandomColor(), 1);
+                    }
+                    pictureShow.Image = pictureMain.ToBitmap();
+                    display("绘制轮廓");
+                    break;
+                case (int)lb1_list.template:
+                    if (form2image != null && pictureMain.Rows > form2image.Rows && pictureMain.Cols > form2image.Cols)
+                    {
+                        Mat result = new Mat(pictureMain.Cols - form2image.Cols, pictureMain.Rows - form2image.Cols, MatType.CV_32FC1);
+                        Cv2.MatchTemplate(pictureMain, form2image, result, TemplateMatchModes.CCoeff);
+                        double maxVal, minVal;
+                        OpenCvSharp.Point minLoc, maxLoc;
+                        Cv2.Normalize(result, result, 0, 1, NormTypes.MinMax);
+                        Cv2.MinMaxLoc(result, out minVal, out maxVal, out minLoc, out maxLoc);
+                        Cv2.ImShow("匹配的图像", form2image);
+                        pictureMain.Rectangle(maxLoc, new OpenCvSharp.Point(maxLoc.X + form2image.Cols, maxLoc.Y + form2image.Rows), Scalar.Red);
+                        pictureShow.Image = pictureMain.ToBitmap();
+                        textBox1.AppendText("\r\n模板匹配程度为:" + maxVal * 100 + " % ");
+                    }
+                    else if (form2image == null)
+                    {
+                        MessageBox.Show("请在窗口二中传入匹配图像");
+                    }
+                    else
+                    {
+                        MessageBox.Show("匹配图像需要比原始图像小");
+                    }
+                    display("模板匹配");
+                    break;
+                case (int)lb1_list.drawRect:
+                    Cv2.ImShow("最小外包矩形", pictureMain);
+                    Mat tempRect = new Mat();
+                    pictureMain.CopyTo(tempRect);
+                    CvTrackbarCallback2 crbc_rect = new CvTrackbarCallback2(drawRect);
+                    CvTrackbar cvtb_rect = new CvTrackbar("程度", "最小外包矩形", 0, 20, crbc_rect, tempRect);
+                    MessageBox.Show("这个处理内存占用巨大,不要拖动太多次");
+                    break;
+                default:
+                    break;
+            }
+        }
+        /// <summary>
+        /// 图像处理后更新信息
+        /// </summary>
+        /// <param name="name"></param>
+        public void display(string name)
+        {
+            textBox1.AppendText("\r\n图像运行"+ name+ "处理成功");
+            textBox1.SelectionStart = this.textBox1.TextLength;
+            textBox1.ScrollToCaret();
+            listBox2.Items.Add(num + ". "+ name);
+            num++;
+        }
+
+        private void button2_Click(object sender, EventArgs e)
+        {
+            Form2 form2 = new Form2();
+            form2.Show(this);
+        }
+
+        private void initalBtn_Click(object sender, EventArgs e)
+        {
+            pictureMain = null;
+            pictureShow.Image = null;
+            num = 1;
+            listBox2.Items.Clear();
+            textBox1.Text = "以下为通知信息:";
+        }
+    }
+}
+

+ 120 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Form1.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 149 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Form2.Designer.cs

@@ -0,0 +1,149 @@
+namespace 简单图像处理软件
+{
+    partial class Form2
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.button1 = new System.Windows.Forms.Button();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.button2 = new System.Windows.Forms.Button();
+            this.button3 = new System.Windows.Forms.Button();
+            this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
+            this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(71, 70);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.TabIndex = 0;
+            this.button1.Text = "浏览";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(169, 72);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(269, 21);
+            this.textBox1.TabIndex = 1;
+            // 
+            // button2
+            // 
+            this.button2.Location = new System.Drawing.Point(71, 280);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(75, 23);
+            this.button2.TabIndex = 2;
+            this.button2.Text = "确定";
+            this.button2.UseVisualStyleBackColor = true;
+            this.button2.Click += new System.EventHandler(this.button2_Click);
+            // 
+            // button3
+            // 
+            this.button3.Location = new System.Drawing.Point(247, 280);
+            this.button3.Name = "button3";
+            this.button3.Size = new System.Drawing.Size(75, 23);
+            this.button3.TabIndex = 3;
+            this.button3.Text = "取消";
+            this.button3.UseVisualStyleBackColor = true;
+            this.button3.Click += new System.EventHandler(this.button3_Click);
+            // 
+            // numericUpDown1
+            // 
+            this.numericUpDown1.Location = new System.Drawing.Point(169, 131);
+            this.numericUpDown1.Name = "numericUpDown1";
+            this.numericUpDown1.Size = new System.Drawing.Size(84, 21);
+            this.numericUpDown1.TabIndex = 4;
+            // 
+            // numericUpDown2
+            // 
+            this.numericUpDown2.Location = new System.Drawing.Point(169, 180);
+            this.numericUpDown2.Name = "numericUpDown2";
+            this.numericUpDown2.Size = new System.Drawing.Size(84, 21);
+            this.numericUpDown2.TabIndex = 5;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(67, 131);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(57, 19);
+            this.label1.TabIndex = 6;
+            this.label1.Text = "参数1";
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.Location = new System.Drawing.Point(67, 180);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(57, 19);
+            this.label2.TabIndex = 7;
+            this.label2.Text = "参数2";
+            // 
+            // Form2
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
+            this.ClientSize = new System.Drawing.Size(476, 361);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.numericUpDown2);
+            this.Controls.Add(this.numericUpDown1);
+            this.Controls.Add(this.button3);
+            this.Controls.Add(this.button2);
+            this.Controls.Add(this.textBox1);
+            this.Controls.Add(this.button1);
+            this.Name = "Form2";
+            this.Text = "窗口二";
+            this.Load += new System.EventHandler(this.Form2_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.Button button2;
+        private System.Windows.Forms.Button button3;
+        private System.Windows.Forms.NumericUpDown numericUpDown1;
+        private System.Windows.Forms.NumericUpDown numericUpDown2;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label2;
+    }
+}

+ 107 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Form2.cs

@@ -0,0 +1,107 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using OpenCvSharp;
+
+namespace 简单图像处理软件
+{
+
+    public partial class Form2 : Form
+    {
+
+        public Form2()
+        {
+            InitializeComponent();
+        }
+        string form2fileName;
+        private void button1_Click(object sender, EventArgs e)
+        {
+            OpenFileDialog ofd = new OpenFileDialog();
+            ofd.InitialDirectory = @"";
+            ofd.Filter = "图像文件|*.jpg;*bmp;*png|全部文件|*.*";
+            ofd.Multiselect = false;
+            ofd.ShowDialog();
+            
+            if (ofd.FileName!=null)
+            {
+                form2fileName = ofd.FileName;
+                textBox1.Text = form2fileName;
+            }
+            
+            
+        }
+
+        private void button2_Click(object sender, EventArgs e)
+        {
+            Form1 form1 = (Form1)this.Owner;
+            form1.form2Num1 = (float)numericUpDown1.Value;
+            form1.form2Num2 = (float)numericUpDown2.Value;
+            if (form2fileName != null)
+            {
+                try
+                {
+                    form1.form2image = new Mat(form2fileName);
+                    MessageBox.Show("图面已装载");
+                }
+                catch
+                {
+                    MessageBox.Show("文件名错误");
+                }
+            }
+            //this.Close();
+
+        }
+
+        private void button3_Click(object sender, EventArgs e)
+        {
+            this.Close();
+        }
+        public enum lb1_list//记录操作方法
+        {
+            gray,
+            reverse,
+            binary,
+            gaussianBlur,
+            blur,
+            medianBlur,
+            bilateralFilter,
+            sobel,
+            scharr,
+            canny,
+            Laplacian,
+            carve,
+            rever_lr,
+            rever_tb,
+            frost,
+            sharp,
+            dilate,
+            erode,
+            tophat,
+            blackhat,
+            gamma,
+            log,
+            hist,
+            findContours
+        }
+        private void Form2_Load(object sender, EventArgs e)
+        {
+            //Form1 form1 = (Form1)this.Owner;
+            //switch (form1.selectIndex)
+            //{
+            //    case (int)lb1_list.findContours:
+            //        button1.Visible = false;
+            //        textBox1.Visible = false;
+            //        label1.Text = "threshold1";
+            //        label2.Text = "threshold2";
+            //        break;
+            //}
+        }
+
+    }
+}

+ 120 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Form2.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 22 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Program.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace 简单图像处理软件
+{
+    static class Program
+    {
+        /// <summary>
+        /// 应用程序的主入口点。
+        /// </summary>
+        [STAThread]
+        static void Main()
+        {
+            Application.EnableVisualStyles();
+            Application.SetCompatibleTextRenderingDefault(false);
+            Application.Run(new Form1());
+        }
+    }
+}

+ 36 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("简单图像处理软件")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("简单图像处理软件")]
+[assembly: AssemblyCopyright("Copyright ©  2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//将 ComVisible 设置为 false 将使此程序集中的类型
+//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("56ab42d5-110c-47f0-96d4-72d5507f04f4")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
+// 方法是按如下所示使用“*”: :
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 71 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Properties/Resources.Designer.cs

@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本: 4.0.30319.42000
+//
+//     对此文件的更改可能导致不正确的行为,如果
+//     重新生成代码,则所做更改将丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace 简单图像处理软件.Properties
+{
+
+
+    /// <summary>
+    ///   强类型资源类,用于查找本地化字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources
+    {
+
+        private static global::System.Resources.ResourceManager resourceMan;
+
+        private static global::System.Globalization.CultureInfo resourceCulture;
+
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources()
+        {
+        }
+
+        /// <summary>
+        ///   返回此类使用的缓存 ResourceManager 实例。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager
+        {
+            get
+            {
+                if ((resourceMan == null))
+                {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("简单图像处理软件.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+
+        /// <summary>
+        ///   覆盖当前线程的 CurrentUICulture 属性
+        ///   使用此强类型的资源类的资源查找。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture
+        {
+            get
+            {
+                return resourceCulture;
+            }
+            set
+            {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 30 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Properties/Settings.Designer.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace 简单图像处理软件.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

+ 111 - 0
OpenCVTest/简单图像处理软件/简单图像处理软件/简单图像处理软件.csproj

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{56AB42D5-110C-47F0-96D4-72D5507F04F4}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>简单图像处理软件</RootNamespace>
+    <AssemblyName>简单图像处理软件</AssemblyName>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="OpenCvSharp">
+      <HintPath>..\..\控件\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp.Blob">
+      <HintPath>..\..\控件\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.Blob.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp.Extensions">
+      <HintPath>..\..\控件\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="OpenCvSharp.UserInterface">
+      <HintPath>..\..\控件\packages\OpenCvSharp3-AnyCPU.4.0.0.20181129\lib\net461\OpenCvSharp.UserInterface.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Deployment" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Form1.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Form1.Designer.cs">
+      <DependentUpon>Form1.cs</DependentUpon>
+    </Compile>
+    <Compile Include="Form2.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Form2.Designer.cs">
+      <DependentUpon>Form2.cs</DependentUpon>
+    </Compile>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="Form1.resx">
+      <DependentUpon>Form1.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Form2.resx">
+      <DependentUpon>Form2.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>