form1.cs
来自「设置字体的颜色以和字体的样式,如果有什么错误请你们多多指教,请请在家了!」· CS 代码 · 共 53 行
CS
53 行
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 + =
减小字号Ctrl + -
显示快捷键?