diff --git a/Config.mdb b/Config.mdb
new file mode 100644
index 0000000000000000000000000000000000000000..328aa70d56bc5e43ccc8ed57933d98574836bcc9
Binary files /dev/null and b/Config.mdb differ
diff --git a/GroupList_jike.md b/GroupList_jike.md
index 551b4f2bfad80a4a4fd11c40c8a9e39538a196d9..2101567e1f14bdada3c83657f022f8ac24dd1b6a 100644
--- a/GroupList_jike.md
+++ b/GroupList_jike.md
@@ -304,29 +304,21 @@
项目地址:https://gitee.com/wang1114/finalExam/tree/Feat_face
-#### 景远鹏 (题目:Tensorflow object detection API 打造属于自己的物体检测模型)
-* 组员:
-1. 朱安娜
-2. 王琦琦
-3. 潘璐璐
-4. 张红梅
-5.张玲
-
-* 分工
-1.
-2.
-3.
-4.
-5.
-6.
+#### 景远鹏 (题目:Tensorflow object detection API 验证码识别)
+* 组员及分工
+1. 朱安娜:设计界面,灰度化,去噪
+2. 王琦琦:调用
+3. 潘璐璐:去边框,燃烧遍历
+4. 张红梅:线性插值,坐标切割
+5.张玲:识别
+6.景远鹏:数据库
* 进度计划
-1. 10月份:
-2. 11月份:
-3. 12月份:
-4. 1月份:
-5. 2月份:
-
+1.10月份:收集所需材料,了解训练的过程。同时组织成员探讨确立分工,期间我们参阅了Tensorflow专栏
+2.11月份:初步制定实施方略,安装环境,编写程序代码
+3.12月份:实现功能,进行测试。通过网上项目资源,不断改进完善代码和功能,进行深度了解
+4.1月份:整理结果,完成课程设计报告,向老师展示课程设计成果
+项目地址:https://gitee.com/fgjhqazmlp/finalExam/commit/cd7b48990cb655e65d49a602f0662c0533133e48
#### 徐涛 (题目: )
* 组员:
1. 赵林松
@@ -350,7 +342,7 @@
#### 毕丽群 (题目:)
* 组员:
1. 陈晓瑜
-2. 张玲
+
* 分工
1.
diff --git a/MyClass.cs b/MyClass.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9193cd9b57e3fdc4ea4f21567ad13fe3bc055a58
--- /dev/null
+++ b/MyClass.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+namespace 验证码识别
+{
+ class ClipImage
+ {
+ ///
+ /// 切割预览
+ ///
+ public Bitmap ImagePreView
+ {
+ get;
+ set;
+ }
+ ///
+ /// 切割结果
+ ///
+ public Bitmap[] ClipImages
+ {
+ get;
+ set;
+ }
+ }
+ ///
+ /// 验证码结果
+ ///
+ class VerifyResult
+ {
+ ///
+ /// 相似度
+ ///
+ public double Likeness
+ {
+ get;
+ set;
+ }
+ ///
+ /// 验证码
+ ///
+ public string Code
+ {
+ get;
+ set;
+ }
+ }
+ class SearchResult
+ {
+ ///
+ /// 图像结果
+ ///
+ public Bitmap Image
+ {
+ get;
+ set;
+ }
+ ///
+ /// 开始横坐标
+ ///
+ public int XStart
+ {
+ get;
+ set;
+ }
+ ///
+ /// 开始纵坐标
+ ///
+ public int YStart
+ {
+ get;
+ set;
+ }
+ ///
+ /// 结束横坐标
+ ///
+ public int XEnd
+ {
+ get;
+ set;
+ }
+ ///
+ /// 结束纵坐标
+ ///
+ public int YEnd
+ {
+ get;
+ set;
+ }
+ //当前处理的X坐标
+ public int XCurrent
+ {
+ get;
+ set;
+ }
+ //当前处理的Y坐标
+ public int YCurrent
+ {
+ get;
+ set;
+ }
+ ///
+ /// 像素总点数
+ ///
+ public int pointCount
+ {
+ get;
+ set;
+ }
+
+ }
+}
diff --git a/Program.cs b/Program.cs
new file mode 100644
index 0000000000000000000000000000000000000000..540844e1fdccc7d8afd3d6c5b60951846d54c999
--- /dev/null
+++ b/Program.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace 验证码识别
+{
+ static class Program
+ {
+ ///
+ /// 应用程序的主入口点。
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new mainForm());
+ }
+ }
+}
diff --git a/Verfiy.cs b/Verfiy.cs
new file mode 100644
index 0000000000000000000000000000000000000000..bb223b4137ba08fc52f70289b729063c0d900b71
--- /dev/null
+++ b/Verfiy.cs
@@ -0,0 +1,161 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Text;
+
+namespace 验证码识别
+{
+ class Verfiy
+ {
+ ///
+ /// 进行彩色去噪点
+ ///
+ /// 原位图
+ /// 处理后位图
+ public static Bitmap colorClear(Bitmap image)
+ {
+ //滤波计算
+ //计算该像素点周围8个点及本身的RGB平均值,
+ //计算这9个点到平均值的欧式距离。
+ //从计算中选取最小的,用其RBG值代替该点的RGB值
+ Color currentPixel;
+ Bitmap imageResult = new Bitmap(image);
+ for (int x = 0; x < image.Width; x++)
+ {
+ for (int y = 0; y < image.Height; y++)
+ {
+ //取包括本身在内的9个点。并且计算其平均值
+ int Red = 0, Blue = 0, Green = 0;
+ int PointCount = 0;
+ for (int i = -1; i <= 1; i++)
+ {
+ for (int j = -1; j <= 1; j++)
+ {
+ //有像素点的话,叠加
+ if (x + i >= 0 && y + j >= 0 && x + i < image.Width && y + j < image.Height)
+ {
+ currentPixel = image.GetPixel(x, y);
+ Red += Convert.ToInt32(currentPixel.R);
+ Blue += Convert.ToInt32(currentPixel.B);
+ Green += Convert.ToInt32(currentPixel.G);
+ PointCount++;
+ }
+ }
+ }
+ Red = Red / PointCount;
+ Blue = Blue / PointCount;
+ Green = Green / PointCount;
+ //计算最小的欧式距离
+ double iDistance = 9999999; //默认无限大
+ int iX = x, iY = y; //欧式距离最小的那个色点,默认为本身
+ for (int i = -1; i <= 1; i++)
+ {
+ for (int j = -1; j <= 1; j++)
+ {
+ //有像素点的话,叠加
+ if (x + i >= 0 && y + j >= 0 && x + i < image.Width && y + j < image.Height)
+ {
+ currentPixel = image.GetPixel(x + i, y + j);
+ double iCurrentDistance = Math.Pow((Convert.ToDouble(currentPixel.R) - Red), 2) + Math.Pow(Convert.ToDouble(currentPixel.G) - Green, 2) + Math.Pow(Convert.ToDouble(currentPixel.B) - Blue, 2);
+ if (iCurrentDistance < iDistance)
+ {
+ iX = x + i;
+ iY = y + j;
+ iDistance = iCurrentDistance;
+ }
+ }
+ }
+ }
+ imageResult.SetPixel(x, y, image.GetPixel(iX, iY));
+ }
+ }
+ return imageResult;
+ }
+ ///
+ /// 转化为灰度图像,进行二值化处理
+ ///
+ /// 源图像
+ /// 阈值
+ /// 处理后
+ public static Bitmap toGrey(Bitmap imageSrc,int iThreshold)
+ {
+ //函数将RGB三色表示转换为单比特的0或者1表示
+ //利用公式 Grey=0.3*red+0.59*green+0.11*blue计算出灰度值
+ //大于阈值iThreshold的就放为黑色,小于的话就为白色
+ Color color;
+ Bitmap image = new Bitmap(imageSrc);
+ for (int x = 0; x < image.Width; x++)
+ {
+ for (int y = 0; y < image.Height; y++)
+ {
+ color=image.GetPixel(x,y);
+ double iGrey = 0.3 * Convert.ToInt32(color.R) + 0.59 * Convert.ToInt32(color.G) + 0.11 * Convert.ToInt32(color.B);
+ if (iGrey < iThreshold)
+ {
+ image.SetPixel(x, y, Color.Black);
+ }
+ else
+ {
+ image.SetPixel(x, y, Color.White);
+ }
+ }
+ }
+ return image;
+ }
+ ///
+ /// 黑白去噪
+ ///
+ /// 源图像
+ /// 像素宽度
+ /// 阈值
+ /// 处理后图像
+ public static Bitmap blackClear(Bitmap imageSrc,int iPointWidth, int iThreshold)
+ {
+ //检查像素点,如果为白色0,跳过,如果为黑色1则进行噪点处理
+ //统计周围的像素点,如果白色的个数超过阈值,则认为是噪点,将其设置为白色。
+ Color color;
+ Bitmap image = new Bitmap(imageSrc.Width + 2 * iPointWidth, imageSrc.Height + 2 * iPointWidth);
+ //设置为全白,并拷贝图像
+ Graphics g = Graphics.FromImage(image);
+ g.Clear(Color.White);
+ g.DrawImage(imageSrc,iPointWidth,iPointWidth);
+ g.Dispose();
+ Bitmap imageResult = new Bitmap(image);
+
+ for (int x = iPointWidth-1; x < image.Width-iPointWidth+1; x++)
+ {
+ for (int y = iPointWidth-1; y < image.Height-iPointWidth+1; y++)
+ {
+
+ color = image.GetPixel(x, y);
+ int iWhiteCount = 0;
+ if (color.ToArgb() == Color.Black.ToArgb()) //黑色的话进行检查边上的。注意颜色对象不能直接比较。必须转换一下
+ {
+ for (int i = -iPointWidth; i <= iPointWidth; i++)
+ {
+ for (int j = -iPointWidth; j <= iPointWidth; j++)
+ {
+ //有像素点的话,统计
+ if (x + i >= 0 && y + j >= 0 && x + i < image.Width && y + j < image.Height)
+ {
+ //该边际点为白色,且不是自身
+ if (image.GetPixel(x + i, y + j).ToArgb() == Color.White.ToArgb() && i != 0 && j != 0)
+ {
+ iWhiteCount++;
+ }
+ }
+ }
+ }
+ if (iWhiteCount > iThreshold) //白色点数大于阈值,认为是噪点
+ {
+ imageResult.SetPixel(x, y, Color.White);
+ }
+
+ }
+ }
+ }
+ image.Dispose();
+ return imageResult;
+ }
+ }
+}
diff --git a/VerifyCode.cs b/VerifyCode.cs
new file mode 100644
index 0000000000000000000000000000000000000000..2ca7e69f683cce9c914eeda2a1a76eb045f07c57
--- /dev/null
+++ b/VerifyCode.cs
@@ -0,0 +1,602 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Text;
+using System.Data.OleDb;
+
+namespace 验证码识别
+{
+ class VerifyCode
+ {
+ ///
+ /// 进行彩色去噪点
+ ///
+ /// 原位图
+ /// 处理后位图
+ public static Bitmap colorClear(Bitmap image)
+ {
+ //滤波计算
+ //计算该像素点周围8个点及本身的RGB平均值,
+ //计算这9个点到平均值的欧式距离。
+ //从计算中选取最小的,用其RBG值代替该点的RGB值
+ Color currentPixel;//currentPixel是一个指向UInt32的变量,当你把它加1后,它就会向前移动4字节(32位),然后指向了下一个像素的值。
+ Bitmap imageResult = new Bitmap(image);
+ for (int x = 0; x < image.Width; x++)
+ {
+ for (int y = 0; y < image.Height; y++)
+ {
+ //取包括本身在内的9个点。并且计算其平均值
+ int Red = 0, Blue = 0, Green = 0;
+ int PointCount = 0;
+ for (int i = -1; i <= 1; i++)
+ {
+ for (int j = -1; j <= 1; j++)
+ {
+ //有像素点的话,叠加
+ if (x + i >= 0 && y + j >= 0 && x + i < image.Width && y + j < image.Height)
+ {
+ currentPixel = image.GetPixel(x, y);////GetPixel该函数检索指定坐标点的像素的RGB颜色值。
+ Red += Convert.ToInt32(currentPixel.R);
+ Blue += Convert.ToInt32(currentPixel.B);
+ Green += Convert.ToInt32(currentPixel.G);
+ PointCount++;
+ }
+ }
+ }
+ Red = Red / PointCount;
+ Blue = Blue / PointCount;
+ Green = Green / PointCount;
+ //计算最小的欧式距离
+ double iDistance = 9999999; //默认无限大,Distance距离
+ int iX = x, iY = y; //欧式距离最小的那个色点,默认为本身
+ /**
+ *@得到最小色差
+ *
+ */
+ for (int i = -1; i <= 1; i++)
+ {
+ for (int j = -1; j <= 1; j++)
+ {
+ //有像素点的话,叠加
+ if (x + i >= 0 && y + j >= 0 && x + i < image.Width && y + j < image.Height)//判断边界
+ {
+ currentPixel = image.GetPixel(x + i, y + j);//GetPixel该函数检索指定坐标点的像素的RGB颜色值。
+ double iCurrentDistance = Math.Pow((Convert.ToDouble(currentPixel.R) - Red), 2) + Math.Pow(Convert.ToDouble(currentPixel.G) - Green, 2) + Math.Pow(Convert.ToDouble(currentPixel.B) - Blue, 2);//色差
+ if (iCurrentDistance < iDistance)
+ {
+ iX = x + i;
+ iY = y + j;
+ iDistance = iCurrentDistance;
+ }
+ }
+ }
+ }
+ //Bitmap 类的SetPixel方法,参数X确定横坐标,参数Y确定纵坐标,参数pixel设定颜色
+ imageResult.SetPixel(x, y, image.GetPixel(iX, iY));//SetPixel 设置指定点像素为最接近指定色的近似值
+ }
+ }
+ return imageResult;//返回像素Bitmap结果集
+ }
+ ///
+ /// 转化为灰度图像,进行二值化处理
+ ///
+ /// 源图像
+ /// 阈值
+ /// 处理后
+ public static Bitmap toGrey(Bitmap imageSrc,int iThreshold)
+ {
+ //函数将RGB三色表示转换为单比特的0或者1表示
+ //利用公式 Grey=0.3*red+0.59*green+0.11*blue计算出灰度值
+ //大于阈值iThreshold的就放为黑色,小于的话就为白色
+ Color color;
+ Bitmap image = new Bitmap(imageSrc);//imageSrc要显示的图片
+ for (int x = 0; x < image.Width; x++)//外层循环遍历横坐标
+ {
+ for (int y = 0; y < image.Height; y++)//内层循环遍历y坐标
+ {
+ color=image.GetPixel(x,y);//GetPixel该函数检索指定坐标点的像素的RGB颜色值。
+
+ //按对应颜色比例系数求出灰度值
+ double iGrey = 0.3 * Convert.ToInt32(color.R) + 0.59 * Convert.ToInt32(color.G) + 0.11 * Convert.ToInt32(color.B);
+
+ if (iGrey < iThreshold)//iThreshold传入的参数:阈值
+ {
+ image.SetPixel(x, y, Color.Black);//SetPixel 设置指定点像素为最接近指定色的近似值
+ }
+ else
+ {
+ image.SetPixel(x, y, Color.White);//SetPixel 设置指定点像素为最接近指定色的近似值
+ }
+ }
+ }
+ return image;
+ }
+ ///
+ /// 黑白去噪
+ ///
+ /// 源图像
+ /// 像素宽度
+ /// 阈值
+ /// 处理后图像
+ public static Bitmap blackClear(Bitmap imageSrc,int iPointWidth, int iThreshold)
+ {
+ //检查像素点,如果为白色0,跳过,如果为黑色1则进行噪点处理
+ //统计周围的像素点,如果白色的个数超过阈值,则认为是噪点,将其设置为白色。
+ Color color;
+ Bitmap image = new Bitmap(imageSrc.Width + 2 * iPointWidth, imageSrc.Height + 2 * iPointWidth);
+ //设置为全白,并拷贝图像
+ Graphics g = Graphics.FromImage(image);//从指定的 Image 创建新的 Graphics。
+ g.Clear(Color.White);//用白色擦除对象g,即把img这个Image指针指向的图像填充为白色背景;
+ g.DrawImage(imageSrc,iPointWidth,iPointWidth);//在指定位置并且按指定形状和大小绘制指定的 Image 对象。
+ g.Dispose();
+ Bitmap imageResult = new Bitmap(image);
+
+ for (int x = iPointWidth-1; x < image.Width-iPointWidth+1; x++)
+ {
+ for (int y = iPointWidth-1; y < image.Height-iPointWidth+1; y++)
+ {
+
+ color = image.GetPixel(x, y);//GetPixel该函数检索指定坐标点的像素的RGB颜色值。
+ int iWhiteCount = 0;
+ if (color.ToArgb() == Color.Black.ToArgb()) //黑色的话进行检查边上的。注意颜色对象不能直接比较。必须转换一下.ToArgb()获取此 Color 结构的 32 位 ARGB 值。
+
+ {
+ for (int i = -iPointWidth; i <= iPointWidth; i++)
+ {
+ for (int j = -iPointWidth; j <= iPointWidth; j++)
+ {
+ //有像素点的话,统计
+ if (x + i >= 0 && y + j >= 0 && x + i < image.Width && y + j < image.Height)
+ {
+ //该边际点为白色,且不是自身
+ if (image.GetPixel(x + i, y + j).ToArgb() == Color.White.ToArgb() && i != 0 && j != 0)
+ {
+ iWhiteCount++;
+ }
+ }
+ }
+ }
+ if (iWhiteCount > iThreshold) //白色点数大于阈值,认为是噪点
+ {
+ imageResult.SetPixel(x, y, Color.White);//SetPixel 设置指定点像素为最接近指定色的近似值
+ }
+
+ }
+ }
+ }
+ image.Dispose();
+ return imageResult;
+ }
+ ///
+ /// 显示各列的像素分部情况
+ ///
+ /// 显示的地方
+ /// 要显示的图片
+ /// 数组方式返回各点
+ public static int [] pointShow(ref Bitmap imageShow, Bitmap imageSrc)
+ {
+ int[] iPointCount = new int[imageSrc.Width];
+ Graphics g = Graphics.FromImage(imageShow);//从指定的 Image 创建新的 Graphics。封装一个 GDI+ 绘图图面。 此类不能被继承
+ g.Clear(Color.White);//用白色擦除对象g,即把img这个Image指针指向的图像填充为白色背景;
+ g.Dispose();
+ float iWidthBand = (float)imageShow.Width / imageSrc.Width;
+ float iHeightBand = (float)imageShow.Height / imageSrc.Height;
+ for (int x = 0; x < imageSrc.Width; x++)
+ {
+ int iBlackCount = 0;
+ //映射得到黑色的点数
+ for (int y = 0; y < imageSrc.Height; y++)
+ {// Color.Black获取黑色
+ if (imageSrc.GetPixel(x, y).ToArgb() == Color.Black.ToArgb())//GetPixel该函数检索指定坐标点的像素的RGB颜色值。ToArgb()获取此 Color 结构的 32 位 ARGB 值。
+ iBlackCount++;
+ }
+ int iX = Convert.ToInt32(x * iWidthBand);
+ int iY = Convert.ToInt32(iBlackCount * iHeightBand);//band标记
+ iPointCount[x] = iBlackCount;
+ for (int y = 1; y < imageShow.Height && y < iY; y++)
+ {
+ imageShow.SetPixel(iX, y, Color.Black);
+ }
+
+ }
+ return iPointCount;
+ }
+ ///
+ /// 切割图片
+ ///
+ /// 源图像
+ /// 最少宽度
+ ///
+ public static ClipImage imageSplit(Bitmap imageSrc,int minWidth,int splitThreshold)
+ {
+
+ ClipImage clipImage = new ClipImage();//新建类并保存
+ clipImage.ImagePreView = new Bitmap(imageSrc);//image文件的存储路径
+ clipImage.ClipImages = new Bitmap[10];
+ Graphics g = Graphics.FromImage(clipImage.ImagePreView);
+ Pen pen=new Pen(Brushes.Red);
+
+ int startX = 1; //开始切割的地方
+ int endX = 1; //结束的地方
+ int startY = 1;//纵向开始
+ int endY = 1;//纵向结束
+ bool isChar = false; //是一个验证码字符
+ int iImageIndex=0;
+ //获取各个列的黑色点数
+ for (int x = 0; x < imageSrc.Width; x++)
+ {
+ int iBlackCount = 0;
+ //映射得到黑色的点数
+ for (int y = 0; y < imageSrc.Height; y++)
+ {
+ if (imageSrc.GetPixel(x, y).ToArgb() == Color.Black.ToArgb())
+ iBlackCount++;
+ }
+ if (iBlackCount < splitThreshold) //左边的黑色点数少于预定数,变成红色
+ {
+ g.DrawLine(pen, x, 0, x, imageSrc.Height);
+ //DrawLine(Pen pen, int x1, int y1, int x2, int y2);第一个参数设置颜色,后两个参数设置坐标,将两坐标之间设置为第一个参数颜色
+ endX = x; //当前为结束点
+ if (isChar ==true&&endX-startX>=minWidth)
+ {
+ //这个字符找到了,纵向切割。上下两头逼近
+ #region 找到字符,上下两头逼近
+ int iCount = 0;
+ for (int y = 1; y < imageSrc.Height - 1; y++)
+ {
+ iCount = 0;
+ for (int i = startX; i <= endX; i++)
+ {
+ if (imageSrc.GetPixel(i, y).ToArgb() == Color.Black.ToArgb())
+ iCount++;
+ }
+ //如果像素点超过了2个,那么就设置为开始,退出循环
+ if (iCount > splitThreshold)
+ {
+ startY = y;
+ break;
+ }
+ //否则画红线
+ else
+ {
+ g.DrawLine(pen, startX,y, endX,y);
+ }
+
+ }
+ for (int y = imageSrc.Height - 2; y > 0; y--)
+ {
+ iCount = 0;
+ for (int i = startX; i <= endX; i++)
+ {
+ if (imageSrc.GetPixel(i, y).ToArgb() == Color.Black.ToArgb())
+ iCount++;
+ }
+ //如果像素点超过了2个,那么就设置为开始,退出循环
+ if (iCount > splitThreshold)
+ {
+ endY = y;
+ break;
+ }
+ //否则画红线
+ else
+ {
+ g.DrawLine(pen, startX, y, endX, y);
+ }
+
+ }
+ #endregion
+ Rectangle rec=new Rectangle(startX,startY,endX-startX+1,endY-startY+1);
+ clipImage.ClipImages[iImageIndex] = imageSrc.Clone(rec, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ iImageIndex++;
+ isChar = false;
+ startX = endX;
+ }
+ else
+ {
+ startX = x ;
+ }
+ }
+ else
+ {
+ endX = x ;
+ isChar = true;
+ }
+ }
+ return clipImage;
+ }
+ ///
+ /// 将数据存入数据库,以|符号间隔
+ ///
+ /// 数据库链接字符串
+ /// 验证码来源地址
+ public static void saveImage(Bitmap imageSrc,string sCode,string sConnStr, string sVerifyURL)
+ {
+ //首先将验证码处理成字符串黑色为1,
+ //将字符串,长度,宽度存入数据库
+ OleDbConnection odcConnection = new OleDbConnection(sConnStr);
+ odcConnection.Open();
+ OleDbCommand odCommand = odcConnection.CreateCommand();
+ odCommand.CommandText = "select VerifyID from Verify where VerifyURL='"+sVerifyURL+"'";
+ object sVerifyID = odCommand.ExecuteScalar();
+
+ if (sVerifyID ==null) //如果没有找到。
+ {
+ odCommand.CommandText = "insert into Verify(VerifyURL) values('"+sVerifyURL+"')";
+ odCommand.ExecuteNonQuery();
+ odCommand.CommandText = "select VerifyID from Verify where VerifyURL='" + sVerifyURL + "'";
+ sVerifyID = odCommand.ExecuteScalar().ToString();
+ }
+ string sImageStr = imageToString(imageSrc);
+ odCommand.CommandText = "insert into Model(VerifyID,Code,[Data]) values("+sVerifyID+",'"+sCode+"','"+sImageStr+"')";
+ odCommand.ExecuteNonQuery();
+ odcConnection.Dispose();
+ odCommand.Dispose();
+ }
+ ///
+ /// 将字符图像转换为字符串
+ ///
+ /// 源图像
+ ///
+ public static string imageToString(Bitmap imageSrc)
+ {
+ string sReturnValue = "";
+ for (int y = 0; y < imageSrc.Height; y++)
+ {
+ int iLine = 0;
+ for (int x = 0; x < imageSrc.Width; x++)
+ {
+ if (imageSrc.GetPixel(x, y).ToArgb() == Color.Black.ToArgb())
+ {
+ iLine = iLine << 1 | 1;
+ }
+ else
+ {
+ iLine = iLine << 1 | 0;
+ }
+
+ }
+ sReturnValue += iLine.ToString() + "|";
+ }
+ return sReturnValue.TrimEnd('|');
+ }
+ ///
+ /// 从数据库中检索数据并比较
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static VerifyResult searchCode(Bitmap imageSrc, string sConnStr, string sVerifyURL)
+ {
+ OleDbConnection odcConnection = new OleDbConnection(sConnStr);
+ OleDbDataReader odrReader;
+ //验证码检索返回结果
+ VerifyResult verifyResult = new VerifyResult();
+ verifyResult.Likeness = 0;
+ verifyResult.Code = "*";
+ int[] iDataSrc = stringToInt(imageToString(imageSrc)); //图像装换为整型数组
+ odcConnection.Open();
+ OleDbCommand odCommand = odcConnection.CreateCommand();
+ odCommand.CommandText = "select Code,[Data] from Model inner join Verify on Verify.VerifyID=Model.VerifyID where VerifyURL='"+sVerifyURL+"'";
+ odrReader = odCommand.ExecuteReader();
+ while (odrReader.Read())
+ {
+ int[] iDataNow=stringToInt(odrReader["Data"].ToString());
+ double dLikeTemp = GetCosine(iDataNow, iDataSrc, imageSrc.Width, imageSrc.Height);
+ if (dLikeTemp>0.8&&dLikeTemp > verifyResult.Likeness)
+ {
+ verifyResult.Code = odrReader["Code"].ToString();
+ verifyResult.Likeness = dLikeTemp;
+ }
+ }
+ odrReader.Close();
+ odrReader.Dispose();
+ odcConnection.Dispose();
+ odCommand.Dispose();
+ return verifyResult;
+ }
+ ///
+ /// 字符串装换为整型数组
+ ///
+ ///
+ ///
+ public static int[] stringToInt(string sImageData)
+ {
+ string[] sLines = sImageData.Split('|');
+ int [] iReturnValue=new int[sLines.Length];
+ for (int i = 0; i < sLines.Length; i++)
+ iReturnValue[i] = Convert.ToInt32(sLines[i]);
+ return iReturnValue;
+ }
+ ///
+ /// 比较两个数字的相似度
+ ///
+ ///
+ ///
+ ///
+ public static double GetCosine(int[] e1, int[] e2, int width, int height)
+ {
+ int a = 0;//分母1
+ int b = 0;//分母2
+ int c = 0;//分子
+ for (int y = 0; y < height; ++y)
+ {
+ //两个数组中的整数按位与
+ int i = e2[y] & e1[y];
+ //按位加
+ for (int x = 0; x < width; ++x)
+ {
+ c += (i >> x) & 1;
+ a += (e2[y] >> x) & 1;
+ b += (e1[y] >> x) & 1;
+ }
+ }
+
+ //计算分母
+ int d = a * b;
+
+ return d == 0 ? 0 : c / Math.Sqrt(d);
+ }
+ ///
+ /// 采用双线性内插值算法,缩放图像到31*31
+ ///
+ /// 源图像
+ ///
+ public static Bitmap reSizeImage(Bitmap imageSrc)
+ {
+ /*双线性内插值:
+ * 对于一个目的像素,设置坐标通过反向变换得到的浮点坐标为(i+u,j+v),其中i、j均为非负整数,u、v为[0,1)区间的浮点数,
+ * 则这个像素得值 f(i+u,j+v) 可由原图像中坐标为 (i,j)、(i+1,j)、(i,j+1)、(i+1,j+1)所对应的周围四个像素的值决定,即:
+ * f(i+u,j+v) = (1-u)(1-v)f(i,j) + (1-u)vf(i,j+1) + u(1-v)f(i+1,j) + uvf(i+1,j+1)
+ * 其中f(i,j)表示源图像(i,j)处的的像素值,以此类推
+ */
+ Bitmap image = new Bitmap(31,31);//31*31像素
+ double dX = (float)image.Width / (float)imageSrc.Width; //宽度倍数
+ double dY = (float)image.Height / (float)imageSrc.Height;//高度倍数
+ int i, j;
+ double u, v;
+ double result;
+ Color color;
+ for (int x = 0; x < image.Width; x++)
+ {
+ for (int y = 0; y < image.Height; y++)
+ {
+ i = (int)Math.Floor(x / dX);//宽度倍数获取整数
+ u = x / dX - i;//余下的小数
+ j = (int)Math.Floor(y / dY);//高度倍数
+ v = y / dY - j;
+ result = (1 - u) * (1 - v) * getPixelValue(imageSrc, i, j) + (1 - u) * v * getPixelValue(imageSrc, i, j + 1)
+ + u*(1 - v) * getPixelValue(imageSrc, i + 1, j) + u * v * getPixelValue(imageSrc,i + 1, j + 1);//计算相对应位置的像素值
+ color = result > 0.5 ? Color.Black : Color.White;//指定像素值大于0.5,插入黑色反之插入白色
+ image.SetPixel(x, y, color);
+ }
+ }
+ return image;
+ }
+ ///
+ /// 获得图像某个点的值,黑色为1,白色为0
+ ///
+ /// 源图像
+ /// 横坐标
+ /// 纵坐标
+ ///
+ public static int getPixelValue(Bitmap imageSrc, int x, int y)
+ {
+ int iReturnValue = 0;
+ if (x < imageSrc.Width && y < imageSrc.Height)//在图像坐标内
+ {
+ iReturnValue=imageSrc.GetPixel(x,y).ToArgb()==Color.Black.ToArgb()?1:0;
+ //getPixel 获取指定点像素为最接近指定色的近似值黑色为1,白色为0
+ }
+ return iReturnValue;//返回
+ }
+ ///
+ /// 去除边框
+ ///
+ /// 源图像
+ /// 边框
+ ///
+ public static Bitmap deleteBorder(Bitmap imageSrc, int iBorderWidth)
+ {
+ Bitmap image = new Bitmap(imageSrc.Width - 2 * iBorderWidth, imageSrc.Height - 2 * iBorderWidth);
+ //复制边框以外的图像到新图像
+ Rectangle rec = new Rectangle(iBorderWidth, iBorderWidth, imageSrc.Width - iBorderWidth * 2, imageSrc.Height - iBorderWidth * 2);
+ image = imageSrc.Clone(rec, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ return image;
+ }
+ ///
+ /// 用燃烧法进行图像遍历
+ ///
+ /// 源图像
+ /// 比例
+ ///
+ public static ClipImage imageSplit(Bitmap imageSrc, int iMinPercent)
+ {
+ ClipImage clipImage = new ClipImage();
+ Bitmap image = new Bitmap(imageSrc);
+ clipImage.ClipImages = new Bitmap[10];
+ int iImageOrder = 0;//图片序号
+ int iPointMin = iMinPercent * imageSrc.Height * imageSrc.Width / 100;//符合要求的像素点数
+ //初始化扫描结果
+ SearchResult searchResult = new SearchResult();
+ searchResult.Image = new Bitmap(imageSrc.Width, imageSrc.Height);
+ //全部填充为白色
+ Graphics g = Graphics.FromImage(searchResult.Image);
+ g.Clear(Color.White);
+
+ //纵向扫描过去
+ for (int x = 0; x < imageSrc.Width; x++)
+ {
+ for (int y = 0; y < imageSrc.Height; y++)
+ {
+ if (imageSrc.GetPixel(x, y).ToArgb() == Color.Black.ToArgb())
+ {
+ //从这点开始遍历检索
+ searchResult.pointCount = 0; //连续黑色点数
+ searchResult.XCurrent = x; //当前X坐标
+ searchResult.XEnd = x; //结束X坐标
+ searchResult.XStart = x;//开始X坐标
+ searchResult.YCurrent = y; //当前X坐标
+ searchResult.YEnd = y; //结束Y坐标
+ searchResult.YStart = y; //开始Y坐标
+ searchImage(ref image, ref searchResult);
+
+ if (searchResult.pointCount > iPointMin)
+ {
+ //建立一个图像
+ clipImage.ClipImages[iImageOrder] = new Bitmap(searchResult.XEnd - searchResult.XStart + 1, searchResult.YEnd - searchResult.YStart + 1);
+ //复制保存起来
+ Rectangle rec = new Rectangle(searchResult.XStart, searchResult.YStart, searchResult.XEnd - searchResult.XStart + 1, searchResult.YEnd - searchResult.YStart + 1);
+ clipImage.ClipImages[iImageOrder] = searchResult.Image.Clone(rec, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ iImageOrder++;
+ //将图像再次涂白。
+ g.Clear(Color.White);
+ }
+ }
+ }
+ }
+ g.Dispose();
+ clipImage.ImagePreView = image;
+ return clipImage;
+ }
+ ///
+ /// 检索图像
+ ///
+ /// 源图像
+ /// 结果
+ public static void searchImage(ref Bitmap imageSrc, ref SearchResult searchResult)
+ {
+ //设置源图为红色,表示已遍历到
+ imageSrc.SetPixel(searchResult.XCurrent, searchResult.YCurrent, Color.Red);
+ //设置结果为黑色,存储
+ searchResult.Image.SetPixel(searchResult.XCurrent, searchResult.YCurrent, Color.Black);
+ //有效色素
+ searchResult.pointCount++;
+ //校准图像坐标范围
+ searchResult.XStart = searchResult.XStart < searchResult.XCurrent ? searchResult.XStart : searchResult.XCurrent;
+ searchResult.YStart = searchResult.YStart < searchResult.YCurrent ? searchResult.YStart : searchResult.YCurrent;
+ searchResult.XEnd = searchResult.XEnd > searchResult.XCurrent ? searchResult.XEnd : searchResult.XCurrent;
+ searchResult.YEnd = searchResult.YEnd > searchResult.YCurrent ? searchResult.YEnd : searchResult.YCurrent;
+ //把当前的位置保存下来,因为searchResult是引用传递,数值会变化
+ int iCurrentX = searchResult.XCurrent;
+ int iCurrentY = searchResult.YCurrent;
+ for (int i = -1; i <= 1; i++)
+ {
+ for (int j = -1; j <= 1; j++)
+ {
+ if (iCurrentX + i >= 0 && iCurrentY + j >= 0 && iCurrentX + i < imageSrc.Width && iCurrentY + j < imageSrc.Height)
+ {
+ //边上的8个点,如果为黑色,进入那个点遍历。
+ if (Math.Abs(i + j) == 1 && imageSrc.GetPixel(iCurrentX + i, iCurrentY + j).ToArgb() == Color.Black.ToArgb()) //如果那个点为黑色
+ {
+ searchResult.XCurrent = iCurrentX + i;
+ searchResult.YCurrent = iCurrentY + j;
+ searchImage(ref imageSrc, ref searchResult);
+ }
+
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/mainForm.Designer.cs b/mainForm.Designer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..171e1c460afbd316dc9b91bb80e21f8badbdb191
--- /dev/null
+++ b/mainForm.Designer.cs
@@ -0,0 +1,1061 @@
+namespace 验证码识别
+{
+ partial class mainForm
+ {
+ ///
+ /// 必需的设计器变量。
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 清理所有正在使用的资源。
+ ///
+ /// 如果应释放托管资源,为 true;否则为 false。
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows 窗体设计器生成的代码
+
+ ///
+ /// 设计器支持所需的方法 - 不要
+ /// 使用代码编辑器修改此方法的内容。
+ ///
+ private void InitializeComponent()
+ {
+ this.tbVerifyURL = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.btGetVerify = new System.Windows.Forms.Button();
+ this.pSrc = new System.Windows.Forms.PictureBox();
+ this.btToGrey = new System.Windows.Forms.Button();
+ this.pToGrey = new System.Windows.Forms.PictureBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.udGreyThreshold = new System.Windows.Forms.NumericUpDown();
+ this.btDeleteBorder = new System.Windows.Forms.Button();
+ this.pBlackClear = new System.Windows.Forms.PictureBox();
+ this.btImageSplit = new System.Windows.Forms.Button();
+ this.pictureBox = new System.Windows.Forms.PictureBox();
+ this.label4 = new System.Windows.Forms.Label();
+ this.udSplitThreshold = new System.Windows.Forms.NumericUpDown();
+ this.label5 = new System.Windows.Forms.Label();
+ this.udBorderWidth = new System.Windows.Forms.NumericUpDown();
+ this.pImageSplit = new System.Windows.Forms.PictureBox();
+ this.pVerify0 = new System.Windows.Forms.PictureBox();
+ this.pVerify1 = new System.Windows.Forms.PictureBox();
+ this.pVerify2 = new System.Windows.Forms.PictureBox();
+ this.pVerify3 = new System.Windows.Forms.PictureBox();
+ this.pVerify4 = new System.Windows.Forms.PictureBox();
+ this.pVerify5 = new System.Windows.Forms.PictureBox();
+ this.pVerify6 = new System.Windows.Forms.PictureBox();
+ this.pVerify7 = new System.Windows.Forms.PictureBox();
+ this.btSave0 = new System.Windows.Forms.Button();
+ this.btSave5 = new System.Windows.Forms.Button();
+ this.btSave1 = new System.Windows.Forms.Button();
+ this.btSave2 = new System.Windows.Forms.Button();
+ this.btSave3 = new System.Windows.Forms.Button();
+ this.btSave4 = new System.Windows.Forms.Button();
+ this.btSave7 = new System.Windows.Forms.Button();
+ this.btSave6 = new System.Windows.Forms.Button();
+ this.tbVerify0 = new System.Windows.Forms.TextBox();
+ this.tbVerify5 = new System.Windows.Forms.TextBox();
+ this.tbVerify4 = new System.Windows.Forms.TextBox();
+ this.tbVerify3 = new System.Windows.Forms.TextBox();
+ this.tbVerify2 = new System.Windows.Forms.TextBox();
+ this.tbVerify1 = new System.Windows.Forms.TextBox();
+ this.tbVerify7 = new System.Windows.Forms.TextBox();
+ this.tbVerify6 = new System.Windows.Forms.TextBox();
+ this.btVerifyCode = new System.Windows.Forms.Button();
+ this.lbLike0 = new System.Windows.Forms.Label();
+ this.lbLike1 = new System.Windows.Forms.Label();
+ this.lbLike2 = new System.Windows.Forms.Label();
+ this.lbLike3 = new System.Windows.Forms.Label();
+ this.lbLike4 = new System.Windows.Forms.Label();
+ this.lbLike5 = new System.Windows.Forms.Label();
+ this.lbLike6 = new System.Windows.Forms.Label();
+ this.lbLike7 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.udMinWidth = new System.Windows.Forms.NumericUpDown();
+ this.tbPointCount = new System.Windows.Forms.TextBox();
+ this.btImageResize = new System.Windows.Forms.Button();
+ this.lbImageSize = new System.Windows.Forms.Label();
+ this.lbSize0 = new System.Windows.Forms.Label();
+ this.lbSize1 = new System.Windows.Forms.Label();
+ this.lbSize2 = new System.Windows.Forms.Label();
+ this.lbSize3 = new System.Windows.Forms.Label();
+ this.lbSize4 = new System.Windows.Forms.Label();
+ this.lbSize5 = new System.Windows.Forms.Label();
+ this.lbSize6 = new System.Windows.Forms.Label();
+ this.lbSize7 = new System.Windows.Forms.Label();
+ this.pResize0 = new System.Windows.Forms.PictureBox();
+ this.pResize1 = new System.Windows.Forms.PictureBox();
+ this.pResize2 = new System.Windows.Forms.PictureBox();
+ this.pResize3 = new System.Windows.Forms.PictureBox();
+ this.pResize4 = new System.Windows.Forms.PictureBox();
+ this.pResize5 = new System.Windows.Forms.PictureBox();
+ this.pResize6 = new System.Windows.Forms.PictureBox();
+ this.pResize7 = new System.Windows.Forms.PictureBox();
+ this.btGetCode = new System.Windows.Forms.Button();
+ this.btClearSummary = new System.Windows.Forms.Button();
+ this.btFireSplit = new System.Windows.Forms.Button();
+ this.udUsedPercent = new System.Windows.Forms.NumericUpDown();
+ this.label3 = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize)(this.pSrc)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pToGrey)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.udGreyThreshold)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pBlackClear)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.udSplitThreshold)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.udBorderWidth)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pImageSplit)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify0)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify2)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify3)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify4)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify5)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify6)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify7)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.udMinWidth)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize0)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize2)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize3)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize4)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize5)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize6)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize7)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.udUsedPercent)).BeginInit();
+ this.SuspendLayout();
+ //
+ // tbVerifyURL
+ //
+ this.tbVerifyURL.Location = new System.Drawing.Point(92, 42);
+ this.tbVerifyURL.Name = "tbVerifyURL";
+ this.tbVerifyURL.Size = new System.Drawing.Size(358, 21);
+ this.tbVerifyURL.TabIndex = 0;
+ this.tbVerifyURL.Text = "http://loginserver.ourgame.com/login/OGContorl/heart.ashx";
+ this.tbVerifyURL.TextChanged += new System.EventHandler(this.tbVerifyURL_TextChanged);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(20, 47);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(71, 12);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "验证码URL:";
+ //
+ // btGetVerify
+ //
+ this.btGetVerify.Location = new System.Drawing.Point(459, 40);
+ this.btGetVerify.Name = "btGetVerify";
+ this.btGetVerify.Size = new System.Drawing.Size(75, 23);
+ this.btGetVerify.TabIndex = 2;
+ this.btGetVerify.Text = "获取";
+ this.btGetVerify.UseVisualStyleBackColor = true;
+ this.btGetVerify.Click += new System.EventHandler(this.btGetVerify_Click);
+ //
+ // pSrc
+ //
+ this.pSrc.Location = new System.Drawing.Point(603, 29);
+ this.pSrc.Name = "pSrc";
+ this.pSrc.Size = new System.Drawing.Size(100, 34);
+ this.pSrc.TabIndex = 3;
+ this.pSrc.TabStop = false;
+ this.pSrc.Click += new System.EventHandler(this.pSrc_Click);
+ //
+ // btToGrey
+ //
+ this.btToGrey.Location = new System.Drawing.Point(22, 96);
+ this.btToGrey.Name = "btToGrey";
+ this.btToGrey.Size = new System.Drawing.Size(75, 23);
+ this.btToGrey.TabIndex = 6;
+ this.btToGrey.Text = "二值化";
+ this.btToGrey.UseVisualStyleBackColor = true;
+ this.btToGrey.Click += new System.EventHandler(this.btToGrey_Click);
+ //
+ // pToGrey
+ //
+ this.pToGrey.Location = new System.Drawing.Point(228, 85);
+ this.pToGrey.Name = "pToGrey";
+ this.pToGrey.Size = new System.Drawing.Size(100, 34);
+ this.pToGrey.TabIndex = 7;
+ this.pToGrey.TabStop = false;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(133, 107);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(29, 12);
+ this.label2.TabIndex = 8;
+ this.label2.Text = "阈值";
+ //
+ // udGreyThreshold
+ //
+ this.udGreyThreshold.Location = new System.Drawing.Point(168, 98);
+ this.udGreyThreshold.Maximum = new decimal(new int[] {
+ 255,
+ 0,
+ 0,
+ 0});
+ this.udGreyThreshold.Name = "udGreyThreshold";
+ this.udGreyThreshold.Size = new System.Drawing.Size(40, 21);
+ this.udGreyThreshold.TabIndex = 9;
+ this.udGreyThreshold.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.udGreyThreshold.Value = new decimal(new int[] {
+ 240,
+ 0,
+ 0,
+ 0});
+ //
+ // btDeleteBorder
+ //
+ this.btDeleteBorder.Location = new System.Drawing.Point(22, 147);
+ this.btDeleteBorder.Name = "btDeleteBorder";
+ this.btDeleteBorder.Size = new System.Drawing.Size(75, 23);
+ this.btDeleteBorder.TabIndex = 10;
+ this.btDeleteBorder.Text = "去边框";
+ this.btDeleteBorder.UseVisualStyleBackColor = true;
+ this.btDeleteBorder.Click += new System.EventHandler(this.btDeleteBorder_Click);
+ //
+ // pBlackClear
+ //
+ this.pBlackClear.Location = new System.Drawing.Point(326, 138);
+ this.pBlackClear.Name = "pBlackClear";
+ this.pBlackClear.Size = new System.Drawing.Size(100, 34);
+ this.pBlackClear.TabIndex = 11;
+ this.pBlackClear.TabStop = false;
+ //
+ // btImageSplit
+ //
+ this.btImageSplit.Location = new System.Drawing.Point(22, 264);
+ this.btImageSplit.Name = "btImageSplit";
+ this.btImageSplit.Size = new System.Drawing.Size(75, 23);
+ this.btImageSplit.TabIndex = 14;
+ this.btImageSplit.Text = "坐标切割";
+ this.btImageSplit.UseVisualStyleBackColor = true;
+ this.btImageSplit.Click += new System.EventHandler(this.btImageSplit_Click);
+ //
+ // pictureBox
+ //
+ this.pictureBox.Location = new System.Drawing.Point(450, 85);
+ this.pictureBox.Name = "pictureBox";
+ this.pictureBox.Size = new System.Drawing.Size(353, 145);
+ this.pictureBox.TabIndex = 15;
+ this.pictureBox.TabStop = false;
+ this.pictureBox.Click += new System.EventHandler(this.pictureBox_Click);
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(225, 269);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(29, 12);
+ this.label4.TabIndex = 17;
+ this.label4.Text = "阈值";
+ //
+ // udSplitThreshold
+ //
+ this.udSplitThreshold.Location = new System.Drawing.Point(260, 261);
+ this.udSplitThreshold.Maximum = new decimal(new int[] {
+ 8,
+ 0,
+ 0,
+ 0});
+ this.udSplitThreshold.Name = "udSplitThreshold";
+ this.udSplitThreshold.Size = new System.Drawing.Size(40, 21);
+ this.udSplitThreshold.TabIndex = 18;
+ this.udSplitThreshold.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.udSplitThreshold.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(134, 152);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(53, 12);
+ this.label5.TabIndex = 19;
+ this.label5.Text = "边框像素";
+ //
+ // udBorderWidth
+ //
+ this.udBorderWidth.Location = new System.Drawing.Point(193, 147);
+ this.udBorderWidth.Maximum = new decimal(new int[] {
+ 4,
+ 0,
+ 0,
+ 0});
+ this.udBorderWidth.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.udBorderWidth.Name = "udBorderWidth";
+ this.udBorderWidth.Size = new System.Drawing.Size(40, 21);
+ this.udBorderWidth.TabIndex = 20;
+ this.udBorderWidth.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.udBorderWidth.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ //
+ // pImageSplit
+ //
+ this.pImageSplit.Location = new System.Drawing.Point(326, 253);
+ this.pImageSplit.Name = "pImageSplit";
+ this.pImageSplit.Size = new System.Drawing.Size(100, 34);
+ this.pImageSplit.TabIndex = 25;
+ this.pImageSplit.TabStop = false;
+ //
+ // pVerify0
+ //
+ this.pVerify0.Location = new System.Drawing.Point(155, 381);
+ this.pVerify0.Name = "pVerify0";
+ this.pVerify0.Size = new System.Drawing.Size(31, 31);
+ this.pVerify0.TabIndex = 26;
+ this.pVerify0.TabStop = false;
+ //
+ // pVerify1
+ //
+ this.pVerify1.Location = new System.Drawing.Point(240, 381);
+ this.pVerify1.Name = "pVerify1";
+ this.pVerify1.Size = new System.Drawing.Size(31, 31);
+ this.pVerify1.TabIndex = 27;
+ this.pVerify1.TabStop = false;
+ //
+ // pVerify2
+ //
+ this.pVerify2.Location = new System.Drawing.Point(325, 381);
+ this.pVerify2.Name = "pVerify2";
+ this.pVerify2.Size = new System.Drawing.Size(31, 31);
+ this.pVerify2.TabIndex = 28;
+ this.pVerify2.TabStop = false;
+ //
+ // pVerify3
+ //
+ this.pVerify3.Location = new System.Drawing.Point(410, 381);
+ this.pVerify3.Name = "pVerify3";
+ this.pVerify3.Size = new System.Drawing.Size(31, 31);
+ this.pVerify3.TabIndex = 29;
+ this.pVerify3.TabStop = false;
+ //
+ // pVerify4
+ //
+ this.pVerify4.Location = new System.Drawing.Point(495, 381);
+ this.pVerify4.Name = "pVerify4";
+ this.pVerify4.Size = new System.Drawing.Size(31, 31);
+ this.pVerify4.TabIndex = 30;
+ this.pVerify4.TabStop = false;
+ //
+ // pVerify5
+ //
+ this.pVerify5.Location = new System.Drawing.Point(580, 381);
+ this.pVerify5.Name = "pVerify5";
+ this.pVerify5.Size = new System.Drawing.Size(31, 31);
+ this.pVerify5.TabIndex = 31;
+ this.pVerify5.TabStop = false;
+ //
+ // pVerify6
+ //
+ this.pVerify6.Location = new System.Drawing.Point(665, 381);
+ this.pVerify6.Name = "pVerify6";
+ this.pVerify6.Size = new System.Drawing.Size(31, 31);
+ this.pVerify6.TabIndex = 32;
+ this.pVerify6.TabStop = false;
+ //
+ // pVerify7
+ //
+ this.pVerify7.Location = new System.Drawing.Point(750, 381);
+ this.pVerify7.Name = "pVerify7";
+ this.pVerify7.Size = new System.Drawing.Size(31, 31);
+ this.pVerify7.TabIndex = 33;
+ this.pVerify7.TabStop = false;
+ //
+ // btSave0
+ //
+ this.btSave0.Location = new System.Drawing.Point(155, 567);
+ this.btSave0.Name = "btSave0";
+ this.btSave0.Size = new System.Drawing.Size(26, 23);
+ this.btSave0.TabIndex = 34;
+ this.btSave0.Text = "存";
+ this.btSave0.UseVisualStyleBackColor = true;
+ this.btSave0.Click += new System.EventHandler(this.btSaveImage_Click);
+ //
+ // btSave5
+ //
+ this.btSave5.Location = new System.Drawing.Point(580, 567);
+ this.btSave5.Name = "btSave5";
+ this.btSave5.Size = new System.Drawing.Size(26, 23);
+ this.btSave5.TabIndex = 35;
+ this.btSave5.Text = "存";
+ this.btSave5.UseVisualStyleBackColor = true;
+ this.btSave5.Click += new System.EventHandler(this.btSaveImage_Click);
+ //
+ // btSave1
+ //
+ this.btSave1.Location = new System.Drawing.Point(240, 567);
+ this.btSave1.Name = "btSave1";
+ this.btSave1.Size = new System.Drawing.Size(26, 23);
+ this.btSave1.TabIndex = 36;
+ this.btSave1.Text = "存";
+ this.btSave1.UseVisualStyleBackColor = true;
+ this.btSave1.Click += new System.EventHandler(this.btSaveImage_Click);
+ //
+ // btSave2
+ //
+ this.btSave2.Location = new System.Drawing.Point(325, 567);
+ this.btSave2.Name = "btSave2";
+ this.btSave2.Size = new System.Drawing.Size(26, 23);
+ this.btSave2.TabIndex = 37;
+ this.btSave2.Text = "存";
+ this.btSave2.UseVisualStyleBackColor = true;
+ this.btSave2.Click += new System.EventHandler(this.btSaveImage_Click);
+ //
+ // btSave3
+ //
+ this.btSave3.Location = new System.Drawing.Point(410, 567);
+ this.btSave3.Name = "btSave3";
+ this.btSave3.Size = new System.Drawing.Size(26, 23);
+ this.btSave3.TabIndex = 38;
+ this.btSave3.Text = "存";
+ this.btSave3.UseVisualStyleBackColor = true;
+ this.btSave3.Click += new System.EventHandler(this.btSaveImage_Click);
+ //
+ // btSave4
+ //
+ this.btSave4.Location = new System.Drawing.Point(495, 567);
+ this.btSave4.Name = "btSave4";
+ this.btSave4.Size = new System.Drawing.Size(26, 23);
+ this.btSave4.TabIndex = 39;
+ this.btSave4.Text = "存";
+ this.btSave4.UseVisualStyleBackColor = true;
+ this.btSave4.Click += new System.EventHandler(this.btSaveImage_Click);
+ //
+ // btSave7
+ //
+ this.btSave7.Location = new System.Drawing.Point(750, 567);
+ this.btSave7.Name = "btSave7";
+ this.btSave7.Size = new System.Drawing.Size(26, 23);
+ this.btSave7.TabIndex = 40;
+ this.btSave7.Text = "存";
+ this.btSave7.UseVisualStyleBackColor = true;
+ this.btSave7.Click += new System.EventHandler(this.btSaveImage_Click);
+ //
+ // btSave6
+ //
+ this.btSave6.Location = new System.Drawing.Point(665, 567);
+ this.btSave6.Name = "btSave6";
+ this.btSave6.Size = new System.Drawing.Size(26, 23);
+ this.btSave6.TabIndex = 41;
+ this.btSave6.Text = "存";
+ this.btSave6.UseVisualStyleBackColor = true;
+ this.btSave6.Click += new System.EventHandler(this.btSaveImage_Click);
+ //
+ // tbVerify0
+ //
+ this.tbVerify0.Location = new System.Drawing.Point(155, 522);
+ this.tbVerify0.Name = "tbVerify0";
+ this.tbVerify0.Size = new System.Drawing.Size(24, 21);
+ this.tbVerify0.TabIndex = 42;
+ this.tbVerify0.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // tbVerify5
+ //
+ this.tbVerify5.Location = new System.Drawing.Point(580, 522);
+ this.tbVerify5.Name = "tbVerify5";
+ this.tbVerify5.Size = new System.Drawing.Size(24, 21);
+ this.tbVerify5.TabIndex = 43;
+ this.tbVerify5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // tbVerify4
+ //
+ this.tbVerify4.Location = new System.Drawing.Point(495, 522);
+ this.tbVerify4.Name = "tbVerify4";
+ this.tbVerify4.Size = new System.Drawing.Size(24, 21);
+ this.tbVerify4.TabIndex = 44;
+ this.tbVerify4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // tbVerify3
+ //
+ this.tbVerify3.Location = new System.Drawing.Point(410, 522);
+ this.tbVerify3.Name = "tbVerify3";
+ this.tbVerify3.Size = new System.Drawing.Size(24, 21);
+ this.tbVerify3.TabIndex = 45;
+ this.tbVerify3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // tbVerify2
+ //
+ this.tbVerify2.Location = new System.Drawing.Point(325, 522);
+ this.tbVerify2.Name = "tbVerify2";
+ this.tbVerify2.Size = new System.Drawing.Size(24, 21);
+ this.tbVerify2.TabIndex = 46;
+ this.tbVerify2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // tbVerify1
+ //
+ this.tbVerify1.Location = new System.Drawing.Point(240, 522);
+ this.tbVerify1.Name = "tbVerify1";
+ this.tbVerify1.Size = new System.Drawing.Size(24, 21);
+ this.tbVerify1.TabIndex = 47;
+ this.tbVerify1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // tbVerify7
+ //
+ this.tbVerify7.Location = new System.Drawing.Point(750, 522);
+ this.tbVerify7.Name = "tbVerify7";
+ this.tbVerify7.Size = new System.Drawing.Size(24, 21);
+ this.tbVerify7.TabIndex = 48;
+ this.tbVerify7.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // tbVerify6
+ //
+ this.tbVerify6.Location = new System.Drawing.Point(665, 522);
+ this.tbVerify6.Name = "tbVerify6";
+ this.tbVerify6.Size = new System.Drawing.Size(24, 21);
+ this.tbVerify6.TabIndex = 49;
+ this.tbVerify6.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ //
+ // btVerifyCode
+ //
+ this.btVerifyCode.Location = new System.Drawing.Point(726, 36);
+ this.btVerifyCode.Name = "btVerifyCode";
+ this.btVerifyCode.Size = new System.Drawing.Size(75, 23);
+ this.btVerifyCode.TabIndex = 50;
+ this.btVerifyCode.Text = "一键";
+ this.btVerifyCode.UseVisualStyleBackColor = true;
+ this.btVerifyCode.Click += new System.EventHandler(this.btVerifyCode_Click);
+ //
+ // lbLike0
+ //
+ this.lbLike0.AutoSize = true;
+ this.lbLike0.Location = new System.Drawing.Point(153, 490);
+ this.lbLike0.Name = "lbLike0";
+ this.lbLike0.Size = new System.Drawing.Size(41, 12);
+ this.lbLike0.TabIndex = 51;
+ this.lbLike0.Text = "相似度";
+ //
+ // lbLike1
+ //
+ this.lbLike1.AutoSize = true;
+ this.lbLike1.Location = new System.Drawing.Point(238, 490);
+ this.lbLike1.Name = "lbLike1";
+ this.lbLike1.Size = new System.Drawing.Size(41, 12);
+ this.lbLike1.TabIndex = 52;
+ this.lbLike1.Text = "相似度";
+ //
+ // lbLike2
+ //
+ this.lbLike2.AutoSize = true;
+ this.lbLike2.Location = new System.Drawing.Point(323, 490);
+ this.lbLike2.Name = "lbLike2";
+ this.lbLike2.Size = new System.Drawing.Size(41, 12);
+ this.lbLike2.TabIndex = 53;
+ this.lbLike2.Text = "相似度";
+ //
+ // lbLike3
+ //
+ this.lbLike3.AutoSize = true;
+ this.lbLike3.Location = new System.Drawing.Point(408, 490);
+ this.lbLike3.Name = "lbLike3";
+ this.lbLike3.Size = new System.Drawing.Size(41, 12);
+ this.lbLike3.TabIndex = 54;
+ this.lbLike3.Text = "相似度";
+ //
+ // lbLike4
+ //
+ this.lbLike4.AutoSize = true;
+ this.lbLike4.Location = new System.Drawing.Point(493, 490);
+ this.lbLike4.Name = "lbLike4";
+ this.lbLike4.Size = new System.Drawing.Size(41, 12);
+ this.lbLike4.TabIndex = 55;
+ this.lbLike4.Text = "相似度";
+ //
+ // lbLike5
+ //
+ this.lbLike5.AutoSize = true;
+ this.lbLike5.Location = new System.Drawing.Point(578, 490);
+ this.lbLike5.Name = "lbLike5";
+ this.lbLike5.Size = new System.Drawing.Size(41, 12);
+ this.lbLike5.TabIndex = 56;
+ this.lbLike5.Text = "相似度";
+ //
+ // lbLike6
+ //
+ this.lbLike6.AutoSize = true;
+ this.lbLike6.Location = new System.Drawing.Point(663, 490);
+ this.lbLike6.Name = "lbLike6";
+ this.lbLike6.Size = new System.Drawing.Size(41, 12);
+ this.lbLike6.TabIndex = 57;
+ this.lbLike6.Text = "相似度";
+ //
+ // lbLike7
+ //
+ this.lbLike7.AutoSize = true;
+ this.lbLike7.Location = new System.Drawing.Point(748, 490);
+ this.lbLike7.Name = "lbLike7";
+ this.lbLike7.Size = new System.Drawing.Size(41, 12);
+ this.lbLike7.TabIndex = 58;
+ this.lbLike7.Text = "相似度";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(135, 269);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(29, 12);
+ this.label6.TabIndex = 59;
+ this.label6.Text = "符宽";
+ //
+ // udMinWidth
+ //
+ this.udMinWidth.Location = new System.Drawing.Point(168, 264);
+ this.udMinWidth.Maximum = new decimal(new int[] {
+ 8,
+ 0,
+ 0,
+ 0});
+ this.udMinWidth.Name = "udMinWidth";
+ this.udMinWidth.Size = new System.Drawing.Size(40, 21);
+ this.udMinWidth.TabIndex = 60;
+ this.udMinWidth.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.udMinWidth.Value = new decimal(new int[] {
+ 8,
+ 0,
+ 0,
+ 0});
+ //
+ // tbPointCount
+ //
+ this.tbPointCount.Location = new System.Drawing.Point(22, 310);
+ this.tbPointCount.Multiline = true;
+ this.tbPointCount.Name = "tbPointCount";
+ this.tbPointCount.ReadOnly = true;
+ this.tbPointCount.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.tbPointCount.Size = new System.Drawing.Size(779, 55);
+ this.tbPointCount.TabIndex = 61;
+ //
+ // btImageResize
+ //
+ this.btImageResize.Location = new System.Drawing.Point(23, 448);
+ this.btImageResize.Name = "btImageResize";
+ this.btImageResize.Size = new System.Drawing.Size(75, 23);
+ this.btImageResize.TabIndex = 62;
+ this.btImageResize.Text = "线性插值";
+ this.btImageResize.UseVisualStyleBackColor = true;
+ this.btImageResize.Click += new System.EventHandler(this.btImageResize_Click);
+ //
+ // lbImageSize
+ //
+ this.lbImageSize.AutoSize = true;
+ this.lbImageSize.Location = new System.Drawing.Point(549, 45);
+ this.lbImageSize.Name = "lbImageSize";
+ this.lbImageSize.Size = new System.Drawing.Size(29, 12);
+ this.lbImageSize.TabIndex = 63;
+ this.lbImageSize.Text = "大小";
+ //
+ // lbSize0
+ //
+ this.lbSize0.AutoSize = true;
+ this.lbSize0.Location = new System.Drawing.Point(120, 400);
+ this.lbSize0.Name = "lbSize0";
+ this.lbSize0.Size = new System.Drawing.Size(29, 12);
+ this.lbSize0.TabIndex = 64;
+ this.lbSize0.Text = "大小";
+ //
+ // lbSize1
+ //
+ this.lbSize1.AutoSize = true;
+ this.lbSize1.Location = new System.Drawing.Point(205, 400);
+ this.lbSize1.Name = "lbSize1";
+ this.lbSize1.Size = new System.Drawing.Size(29, 12);
+ this.lbSize1.TabIndex = 65;
+ this.lbSize1.Text = "大小";
+ //
+ // lbSize2
+ //
+ this.lbSize2.AutoSize = true;
+ this.lbSize2.Location = new System.Drawing.Point(290, 400);
+ this.lbSize2.Name = "lbSize2";
+ this.lbSize2.Size = new System.Drawing.Size(29, 12);
+ this.lbSize2.TabIndex = 66;
+ this.lbSize2.Text = "大小";
+ //
+ // lbSize3
+ //
+ this.lbSize3.AutoSize = true;
+ this.lbSize3.Location = new System.Drawing.Point(375, 400);
+ this.lbSize3.Name = "lbSize3";
+ this.lbSize3.Size = new System.Drawing.Size(29, 12);
+ this.lbSize3.TabIndex = 67;
+ this.lbSize3.Text = "大小";
+ //
+ // lbSize4
+ //
+ this.lbSize4.AutoSize = true;
+ this.lbSize4.Location = new System.Drawing.Point(460, 400);
+ this.lbSize4.Name = "lbSize4";
+ this.lbSize4.Size = new System.Drawing.Size(29, 12);
+ this.lbSize4.TabIndex = 68;
+ this.lbSize4.Text = "大小";
+ //
+ // lbSize5
+ //
+ this.lbSize5.AutoSize = true;
+ this.lbSize5.Location = new System.Drawing.Point(545, 400);
+ this.lbSize5.Name = "lbSize5";
+ this.lbSize5.Size = new System.Drawing.Size(29, 12);
+ this.lbSize5.TabIndex = 69;
+ this.lbSize5.Text = "大小";
+ //
+ // lbSize6
+ //
+ this.lbSize6.AutoSize = true;
+ this.lbSize6.Location = new System.Drawing.Point(630, 400);
+ this.lbSize6.Name = "lbSize6";
+ this.lbSize6.Size = new System.Drawing.Size(29, 12);
+ this.lbSize6.TabIndex = 70;
+ this.lbSize6.Text = "大小";
+ //
+ // lbSize7
+ //
+ this.lbSize7.AutoSize = true;
+ this.lbSize7.Location = new System.Drawing.Point(715, 400);
+ this.lbSize7.Name = "lbSize7";
+ this.lbSize7.Size = new System.Drawing.Size(29, 12);
+ this.lbSize7.TabIndex = 71;
+ this.lbSize7.Text = "大小";
+ //
+ // pResize0
+ //
+ this.pResize0.Location = new System.Drawing.Point(155, 440);
+ this.pResize0.Name = "pResize0";
+ this.pResize0.Size = new System.Drawing.Size(31, 31);
+ this.pResize0.TabIndex = 72;
+ this.pResize0.TabStop = false;
+ //
+ // pResize1
+ //
+ this.pResize1.Location = new System.Drawing.Point(240, 440);
+ this.pResize1.Name = "pResize1";
+ this.pResize1.Size = new System.Drawing.Size(31, 31);
+ this.pResize1.TabIndex = 73;
+ this.pResize1.TabStop = false;
+ //
+ // pResize2
+ //
+ this.pResize2.Location = new System.Drawing.Point(325, 440);
+ this.pResize2.Name = "pResize2";
+ this.pResize2.Size = new System.Drawing.Size(31, 31);
+ this.pResize2.TabIndex = 74;
+ this.pResize2.TabStop = false;
+ //
+ // pResize3
+ //
+ this.pResize3.Location = new System.Drawing.Point(410, 440);
+ this.pResize3.Name = "pResize3";
+ this.pResize3.Size = new System.Drawing.Size(31, 31);
+ this.pResize3.TabIndex = 75;
+ this.pResize3.TabStop = false;
+ //
+ // pResize4
+ //
+ this.pResize4.Location = new System.Drawing.Point(495, 440);
+ this.pResize4.Name = "pResize4";
+ this.pResize4.Size = new System.Drawing.Size(31, 31);
+ this.pResize4.TabIndex = 76;
+ this.pResize4.TabStop = false;
+ //
+ // pResize5
+ //
+ this.pResize5.Location = new System.Drawing.Point(580, 440);
+ this.pResize5.Name = "pResize5";
+ this.pResize5.Size = new System.Drawing.Size(31, 31);
+ this.pResize5.TabIndex = 77;
+ this.pResize5.TabStop = false;
+ //
+ // pResize6
+ //
+ this.pResize6.Location = new System.Drawing.Point(665, 440);
+ this.pResize6.Name = "pResize6";
+ this.pResize6.Size = new System.Drawing.Size(31, 31);
+ this.pResize6.TabIndex = 78;
+ this.pResize6.TabStop = false;
+ //
+ // pResize7
+ //
+ this.pResize7.Location = new System.Drawing.Point(750, 440);
+ this.pResize7.Name = "pResize7";
+ this.pResize7.Size = new System.Drawing.Size(31, 31);
+ this.pResize7.TabIndex = 79;
+ this.pResize7.TabStop = false;
+ //
+ // btGetCode
+ //
+ this.btGetCode.AutoEllipsis = true;
+ this.btGetCode.Location = new System.Drawing.Point(23, 502);
+ this.btGetCode.Name = "btGetCode";
+ this.btGetCode.Size = new System.Drawing.Size(75, 23);
+ this.btGetCode.TabIndex = 80;
+ this.btGetCode.Text = "识别";
+ this.btGetCode.UseVisualStyleBackColor = true;
+ this.btGetCode.Click += new System.EventHandler(this.btGetCode_Click);
+ //
+ // btClearSummary
+ //
+ this.btClearSummary.Location = new System.Drawing.Point(23, 553);
+ this.btClearSummary.Name = "btClearSummary";
+ this.btClearSummary.Size = new System.Drawing.Size(75, 23);
+ this.btClearSummary.TabIndex = 82;
+ this.btClearSummary.Text = "统计";
+ this.btClearSummary.UseVisualStyleBackColor = true;
+ this.btClearSummary.Click += new System.EventHandler(this.tbClearSummary_Click);
+ //
+ // btFireSplit
+ //
+ this.btFireSplit.Location = new System.Drawing.Point(22, 207);
+ this.btFireSplit.Name = "btFireSplit";
+ this.btFireSplit.Size = new System.Drawing.Size(75, 23);
+ this.btFireSplit.TabIndex = 83;
+ this.btFireSplit.Text = "燃烧切割";
+ this.btFireSplit.UseVisualStyleBackColor = true;
+ this.btFireSplit.Click += new System.EventHandler(this.btFireSplit_Click);
+ //
+ // udUsedPercent
+ //
+ this.udUsedPercent.Location = new System.Drawing.Point(205, 207);
+ this.udUsedPercent.Maximum = new decimal(new int[] {
+ 30,
+ 0,
+ 0,
+ 0});
+ this.udUsedPercent.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.udUsedPercent.Name = "udUsedPercent";
+ this.udUsedPercent.Size = new System.Drawing.Size(40, 21);
+ this.udUsedPercent.TabIndex = 84;
+ this.udUsedPercent.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.udUsedPercent.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(134, 212);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(65, 12);
+ this.label3.TabIndex = 85;
+ this.label3.Text = "有效百分比";
+ //
+ // mainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(842, 609);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.udUsedPercent);
+ this.Controls.Add(this.btFireSplit);
+ this.Controls.Add(this.btClearSummary);
+ this.Controls.Add(this.btGetCode);
+ this.Controls.Add(this.pResize7);
+ this.Controls.Add(this.pResize6);
+ this.Controls.Add(this.pResize5);
+ this.Controls.Add(this.pResize4);
+ this.Controls.Add(this.pResize3);
+ this.Controls.Add(this.pResize2);
+ this.Controls.Add(this.pResize1);
+ this.Controls.Add(this.pResize0);
+ this.Controls.Add(this.lbSize7);
+ this.Controls.Add(this.lbSize6);
+ this.Controls.Add(this.lbSize5);
+ this.Controls.Add(this.lbSize4);
+ this.Controls.Add(this.lbSize3);
+ this.Controls.Add(this.lbSize2);
+ this.Controls.Add(this.lbSize1);
+ this.Controls.Add(this.lbSize0);
+ this.Controls.Add(this.lbImageSize);
+ this.Controls.Add(this.btImageResize);
+ this.Controls.Add(this.tbPointCount);
+ this.Controls.Add(this.udMinWidth);
+ this.Controls.Add(this.label6);
+ this.Controls.Add(this.lbLike7);
+ this.Controls.Add(this.lbLike6);
+ this.Controls.Add(this.lbLike5);
+ this.Controls.Add(this.lbLike4);
+ this.Controls.Add(this.lbLike3);
+ this.Controls.Add(this.lbLike2);
+ this.Controls.Add(this.lbLike1);
+ this.Controls.Add(this.lbLike0);
+ this.Controls.Add(this.btVerifyCode);
+ this.Controls.Add(this.tbVerify6);
+ this.Controls.Add(this.tbVerify7);
+ this.Controls.Add(this.tbVerify1);
+ this.Controls.Add(this.tbVerify2);
+ this.Controls.Add(this.tbVerify3);
+ this.Controls.Add(this.tbVerify4);
+ this.Controls.Add(this.tbVerify5);
+ this.Controls.Add(this.tbVerify0);
+ this.Controls.Add(this.btSave6);
+ this.Controls.Add(this.btSave7);
+ this.Controls.Add(this.btSave4);
+ this.Controls.Add(this.btSave3);
+ this.Controls.Add(this.btSave2);
+ this.Controls.Add(this.btSave1);
+ this.Controls.Add(this.btSave5);
+ this.Controls.Add(this.btSave0);
+ this.Controls.Add(this.pVerify7);
+ this.Controls.Add(this.pVerify6);
+ this.Controls.Add(this.pVerify5);
+ this.Controls.Add(this.pVerify4);
+ this.Controls.Add(this.pVerify3);
+ this.Controls.Add(this.pVerify2);
+ this.Controls.Add(this.pVerify1);
+ this.Controls.Add(this.pVerify0);
+ this.Controls.Add(this.pImageSplit);
+ this.Controls.Add(this.udBorderWidth);
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.udSplitThreshold);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.pictureBox);
+ this.Controls.Add(this.btImageSplit);
+ this.Controls.Add(this.pBlackClear);
+ this.Controls.Add(this.btDeleteBorder);
+ this.Controls.Add(this.udGreyThreshold);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.pToGrey);
+ this.Controls.Add(this.btToGrey);
+ this.Controls.Add(this.pSrc);
+ this.Controls.Add(this.btGetVerify);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.tbVerifyURL);
+ this.Name = "mainForm";
+ this.Text = "验证码识别";
+ this.Load += new System.EventHandler(this.mainForm_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.pSrc)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pToGrey)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.udGreyThreshold)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pBlackClear)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.udSplitThreshold)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.udBorderWidth)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pImageSplit)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify0)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify2)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify3)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify4)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify5)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify6)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pVerify7)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.udMinWidth)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize0)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize2)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize3)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize4)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize5)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize6)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pResize7)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.udUsedPercent)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox tbVerifyURL;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button btGetVerify;
+ private System.Windows.Forms.PictureBox pSrc;
+ private System.Windows.Forms.Button btToGrey;
+ private System.Windows.Forms.PictureBox pToGrey;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.NumericUpDown udGreyThreshold;
+ private System.Windows.Forms.Button btDeleteBorder;
+ private System.Windows.Forms.PictureBox pBlackClear;
+ private System.Windows.Forms.Button btImageSplit;
+ private System.Windows.Forms.PictureBox pictureBox;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.NumericUpDown udSplitThreshold;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.NumericUpDown udBorderWidth;
+ private System.Windows.Forms.PictureBox pImageSplit;
+ private System.Windows.Forms.PictureBox pVerify0;
+ private System.Windows.Forms.PictureBox pVerify1;
+ private System.Windows.Forms.PictureBox pVerify2;
+ private System.Windows.Forms.PictureBox pVerify3;
+ private System.Windows.Forms.PictureBox pVerify4;
+ private System.Windows.Forms.PictureBox pVerify5;
+ private System.Windows.Forms.PictureBox pVerify6;
+ private System.Windows.Forms.PictureBox pVerify7;
+ private System.Windows.Forms.Button btSave0;
+ private System.Windows.Forms.Button btSave5;
+ private System.Windows.Forms.Button btSave1;
+ private System.Windows.Forms.Button btSave2;
+ private System.Windows.Forms.Button btSave3;
+ private System.Windows.Forms.Button btSave4;
+ private System.Windows.Forms.Button btSave7;
+ private System.Windows.Forms.Button btSave6;
+ private System.Windows.Forms.TextBox tbVerify0;
+ private System.Windows.Forms.TextBox tbVerify5;
+ private System.Windows.Forms.TextBox tbVerify4;
+ private System.Windows.Forms.TextBox tbVerify3;
+ private System.Windows.Forms.TextBox tbVerify2;
+ private System.Windows.Forms.TextBox tbVerify1;
+ private System.Windows.Forms.TextBox tbVerify7;
+ private System.Windows.Forms.TextBox tbVerify6;
+ private System.Windows.Forms.Button btVerifyCode;
+ private System.Windows.Forms.Label lbLike0;
+ private System.Windows.Forms.Label lbLike1;
+ private System.Windows.Forms.Label lbLike2;
+ private System.Windows.Forms.Label lbLike3;
+ private System.Windows.Forms.Label lbLike4;
+ private System.Windows.Forms.Label lbLike5;
+ private System.Windows.Forms.Label lbLike6;
+ private System.Windows.Forms.Label lbLike7;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.NumericUpDown udMinWidth;
+ private System.Windows.Forms.TextBox tbPointCount;
+ private System.Windows.Forms.Button btImageResize;
+ private System.Windows.Forms.Label lbImageSize;
+ private System.Windows.Forms.Label lbSize0;
+ private System.Windows.Forms.Label lbSize1;
+ private System.Windows.Forms.Label lbSize2;
+ private System.Windows.Forms.Label lbSize3;
+ private System.Windows.Forms.Label lbSize4;
+ private System.Windows.Forms.Label lbSize5;
+ private System.Windows.Forms.Label lbSize6;
+ private System.Windows.Forms.Label lbSize7;
+ private System.Windows.Forms.PictureBox pResize0;
+ private System.Windows.Forms.PictureBox pResize1;
+ private System.Windows.Forms.PictureBox pResize2;
+ private System.Windows.Forms.PictureBox pResize3;
+ private System.Windows.Forms.PictureBox pResize4;
+ private System.Windows.Forms.PictureBox pResize5;
+ private System.Windows.Forms.PictureBox pResize6;
+ private System.Windows.Forms.PictureBox pResize7;
+ private System.Windows.Forms.Button btGetCode;
+ private System.Windows.Forms.Button btClearSummary;
+ private System.Windows.Forms.Button btFireSplit;
+ private System.Windows.Forms.NumericUpDown udUsedPercent;
+ private System.Windows.Forms.Label label3;
+ }
+}
+
diff --git a/mainForm.cs b/mainForm.cs
new file mode 100644
index 0000000000000000000000000000000000000000..dacfacd08599691a17b701186dbb4abfd7aff906
--- /dev/null
+++ b/mainForm.cs
@@ -0,0 +1,260 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using System.IO;
+using System.Net;
+
+namespace 验证码识别
+{
+ public partial class mainForm : Form
+ {
+ string sAccessConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\config.mdb;"; //数据库链接
+ int iCharTotal = 0;
+ int iCorrect = 0;
+ public mainForm()
+ {
+ InitializeComponent();
+ }
+ private void btGetVerify_Click(object sender, EventArgs e)
+ {
+ Stream s;
+ try
+ { //建立Web请求获取图像数据流
+ HttpWebRequest wreq = (HttpWebRequest)WebRequest.Create(tbVerifyURL.Text);
+ wreq.KeepAlive = true;
+ HttpWebResponse wresp = (HttpWebResponse)wreq.GetResponse();
+ s = wresp.GetResponseStream();
+ //转换为图形
+ Bitmap Img = new Bitmap(Image.FromStream(s));
+ //设置显示的图片大小和位置
+ pSrc.Width = Img.Width;
+ pSrc.Height = Img.Height;
+ pSrc.Top= btGetVerify.Bottom-Img.Height;
+ pSrc.Image = Img;
+ lbImageSize.Text= Img.Width.ToString() + "X" + Img.Height.ToString();
+ }
+ catch {
+ MessageBox.Show("加载图像失败,请检查链接,或网络");
+ return;
+ }
+ }
+ ///
+ /// 二值化
+ ///
+ ///
+ ///
+ private void btToGrey_Click(object sender, EventArgs e)
+ {
+
+ pToGrey.Width = pSrc.Width;
+ pToGrey.Height = pSrc.Height;
+ pToGrey.Top = btToGrey.Bottom - pToGrey.Height;
+ pToGrey.Image = VerifyCode.toGrey((Bitmap)pSrc.Image, Convert.ToInt32(udGreyThreshold.Value)); //使用自定义toGrey方法加载所有像素
+ }
+ ///
+ /// 去边框
+ ///
+ ///
+ ///
+ private void btDeleteBorder_Click(object sender, EventArgs e)
+ {
+ /*去噪点
+ pBlackClear.Width = pToGrey.Width + Convert.ToInt32(udPointWidth.Value)*2;
+ pBlackClear.Height = pToGrey.Height + Convert.ToInt32(udPointWidth.Value)*2;
+ pBlackClear.Top = btBlackClear.Bottom - pBlackClear.Height;
+ pBlackClear.Image = VerifyCode.blackClear((Bitmap)pToGrey.Image,Convert.ToInt32(udPointWidth.Value), Convert.ToInt32(udBlackClearThreshold.Value));
+ */
+ pBlackClear.Image = VerifyCode.deleteBorder((Bitmap)pToGrey.Image, Convert.ToInt32(udBorderWidth.Value));
+
+ }
+ ///
+ /// 坐标切割
+ ///
+ ///
+ ///
+ private void btImageSplit_Click(object sender, EventArgs e)
+ {
+ Bitmap Img = new Bitmap(pictureBox.Width, pictureBox.Height);
+ int [] iPointCounts= VerifyCode.pointShow(ref Img, (Bitmap)pBlackClear.Image);
+ pictureBox.Image = Img; //图形显示
+ string sPointCount = "";
+ for (int i = 0; i < iPointCounts.Length; i++)
+ {
+ sPointCount += iPointCounts[i].ToString() + ",";
+ }
+ //显示字符串
+ tbPointCount.Text = sPointCount.TrimEnd(',');
+ //切割完成
+ ClipImage clipImage = VerifyCode.imageSplit((Bitmap)pBlackClear.Image,(int)udMinWidth.Value,(int)udSplitThreshold.Value);
+ pImageSplit.Image=clipImage.ImagePreView;
+ for(int i=0;i<8;i++){
+ PictureBox picturebox = (PictureBox)this.Controls["pVerify" + i.ToString()];
+ TextBox textbox=(TextBox)this.Controls["tbVerify"+i.ToString()];
+ Label labelSize = (Label)this.Controls["lbSize" + i.ToString()];
+ if (clipImage.ClipImages[i] != null)
+ {
+ picturebox.Height = clipImage.ClipImages[i].Height;
+ picturebox.Width = clipImage.ClipImages[i].Width;
+ picturebox.Image = clipImage.ClipImages[i];
+ labelSize.Text = picturebox.Width + "X" + picturebox.Height;
+ }
+ }
+ }
+
+ ///
+ /// 一键
+ ///
+ ///
+ ///
+ private void btVerifyCode_Click(object sender, EventArgs e)
+ {
+ btToGrey_Click(null, null);
+ btDeleteBorder_Click(null, null);
+ btFireSplit_Click(null, null);
+ btImageResize_Click(null, null);
+ btGetCode_Click(null, null);
+ }
+ ///
+ /// 存
+ ///
+ ///
+ ///
+ private void btSaveImage_Click(object sender, EventArgs e)
+ {
+ Button button=(Button)sender;
+ string sOrder = button.Name.Replace("btSave", "");
+ PictureBox picturebox = (PictureBox)this.Controls["pResize" + sOrder];
+ TextBox textbox = (TextBox)this.Controls["tbVerify" + sOrder];
+ if (picturebox.Image != null)
+ {
+ VerifyCode.saveImage((Bitmap)picturebox.Image, textbox.Text, sAccessConnStr, tbVerifyURL.Text);
+ }
+ }
+ ///
+ /// 验证码来源改变以后
+ ///
+ ///
+ ///
+ private void tbVerifyURL_TextChanged(object sender, EventArgs e)
+ {
+ switch (tbVerifyURL.Text)
+ {
+ case "http://www.uuplay.com/ValidateCode":
+ udGreyThreshold.Value = 160;
+
+ udBorderWidth.Value = 1;
+ udSplitThreshold.Value = 1;
+ udMinWidth.Value = 3;
+ break;
+ case "http://user.ly.kunlun.com/Verify/login":
+ udGreyThreshold.Value = 112;
+ udBorderWidth.Value = 1;
+ udSplitThreshold.Value = 1;
+ udMinWidth.Value = 8;
+ break;
+ case "http://loginserver.ourgame.com/login/OGContorl/heart.ashx":
+ udGreyThreshold.Value = 240;
+ udBorderWidth.Value = 1;
+ udSplitThreshold.Value = 1;
+ udMinWidth.Value = 8;
+ break;
+ default:
+ break;
+ }
+ }
+ ///
+ /// 线性插值
+ ///
+ ///
+ ///
+ private void btImageResize_Click(object sender, EventArgs e)
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ PictureBox picturebox = (PictureBox)this.Controls["pVerify" + i.ToString()];
+ PictureBox picturebox2 = (PictureBox)this.Controls["pResize" + i.ToString()];
+ if(picturebox.Image!=null)
+ picturebox2.Image = VerifyCode.reSizeImage((Bitmap)picturebox.Image);
+ }
+ }
+ ///
+ /// 识别
+ ///
+ ///
+ ///
+ private void btGetCode_Click(object sender, EventArgs e)
+ {
+ PictureBox picturebox;
+ Label labelLike;
+ TextBox textbox;
+ for (int i = 0; i < 8; i++)
+ {
+ picturebox = (PictureBox)this.Controls["pResize" + i.ToString()];
+ labelLike = (Label)this.Controls["lbLike" + i.ToString()];
+ textbox = (TextBox)this.Controls["tbVerify" + i.ToString()];
+ if (picturebox.Image != null)
+ {
+ VerifyResult verifyResult = VerifyCode.searchCode((Bitmap)picturebox.Image, sAccessConnStr, tbVerifyURL.Text);
+ textbox.Text = verifyResult.Code;
+ iCharTotal++;
+ if (verifyResult.Code != "*")
+ iCorrect++;
+ btClearSummary.Text=iCorrect.ToString()+"/"+iCharTotal.ToString()+","+((iCorrect*100)/iCharTotal).ToString()+"%";
+ labelLike.Text = (Convert.ToInt32(verifyResult.Likeness * 100) / 100.0).ToString();
+ }
+ }
+ }
+ ///
+ /// 统计
+ ///
+ ///
+ ///
+ private void tbClearSummary_Click(object sender, EventArgs e)
+ {
+ iCharTotal = 0;
+ iCorrect = 0;
+ btClearSummary.Text = "已重置";
+ }
+ ///
+ /// 燃烧切割
+ ///
+ ///
+ ///
+ private void btFireSplit_Click(object sender, EventArgs e)
+ {
+ ClipImage clipImage = VerifyCode.imageSplit((Bitmap)pBlackClear.Image,Convert.ToInt32(udUsedPercent.Value));
+ pImageSplit.Image = clipImage.ImagePreView;
+ for (int i = 0; i < 8; i++)
+ {
+ PictureBox picturebox = (PictureBox)this.Controls["pVerify" + i.ToString()];
+ TextBox textbox = (TextBox)this.Controls["tbVerify" + i.ToString()];
+ Label labelSize = (Label)this.Controls["lbSize" + i.ToString()];
+ if (clipImage.ClipImages[i] != null)
+ {
+ picturebox.Height = clipImage.ClipImages[i].Height;
+ picturebox.Width = clipImage.ClipImages[i].Width;
+ picturebox.Image = clipImage.ClipImages[i];
+ }
+ }
+ }
+
+ private void pSrc_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void mainForm_Load(object sender, EventArgs e)
+ {
+
+ }
+
+ private void pictureBox_Click(object sender, EventArgs e)
+ {
+
+ }
+ }
+}
diff --git "a/\351\252\214\350\257\201\347\240\201\350\257\206\345\210\253.sln" "b/\351\252\214\350\257\201\347\240\201\350\257\206\345\210\253.sln"
new file mode 100644
index 0000000000000000000000000000000000000000..485171f817faf54bc51d96821ddca93ed777ff68
--- /dev/null
+++ "b/\351\252\214\350\257\201\347\240\201\350\257\206\345\210\253.sln"
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28010.2046
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VerifyCode", "验证码识别\VerifyCode.csproj", "{B6A33A25-A4EF-4B09-AB51-0911E25C6CC2}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B6A33A25-A4EF-4B09-AB51-0911E25C6CC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B6A33A25-A4EF-4B09-AB51-0911E25C6CC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B6A33A25-A4EF-4B09-AB51-0911E25C6CC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B6A33A25-A4EF-4B09-AB51-0911E25C6CC2}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {CCB33C22-0E71-4FD2-910A-4808BB305DB7}
+ EndGlobalSection
+EndGlobal