⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 设置字体的颜色以和字体的样式,如果有什么错误请你们多多指教,请请在家了!
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ValidationCode
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btntrain_Click(object sender, EventArgs e)
        {
            string curr = Application.StartupPath + "\\bmp\\";
            List<int> x = new List<int>();
            List<List<double>> datain = new List<List<double>>();
            foreach (string path in System.IO.Directory.GetFiles(curr, "*.bmp"))
            {
                ValidationImage img = new ValidationImage((Bitmap)Bitmap.FromFile(path));
                List<double> t = img.test();
                datain.Add(t);
                string temp = path.Replace(curr, "");
                temp = temp.Substring(0, 1);
                x.Add(int.Parse(temp));
            }
            NeuralNet.Train(datain, x);
            MessageBox.Show("ok");
        }

        private void btnrecognize_Click(object sender, EventArgs e)
        {
            this.openFileDialog1.ShowDialog();
            string path = openFileDialog1.FileName;
            this.pictureBox1.Load(path);

            ValidationImage img = new ValidationImage((Bitmap)this.pictureBox1.Image);
            List<double> t = img.test();
            int tt = NeuralNet.Recognize(t);
            this.lbresult.Text = tt.ToString();
        }

      

        
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -