谁有验证码识别控件啊?
发布网友
发布时间:2022-04-29 08:07
我来回答
共1个回答
热心网友
时间:2022-06-24 16:08
private string verCodeToString(Bitmap bitmap)
{
string str = "";
int flag = 0;
Color clrpoint1 = bitmap.GetPixel(13, 3);
if (clrpoint1.R <= 145 & clrpoint1.G <= 145 & clrpoint1.B <= 145)
flag += 1;
Color clrpoint2 = bitmap.GetPixel(12, 5);
if (clrpoint2.R <= 145 & clrpoint2.G <= 145 & clrpoint2.B <= 145)
flag += 2;
Color clrpoint3 = bitmap.GetPixel(15, 8);
if (clrpoint3.R <= 145 & clrpoint3.G <= 145 & clrpoint3.B <= 145)
flag += 4;
Color clrpoint4 = bitmap.GetPixel(16, 14);
if (clrpoint4.R <= 145 & clrpoint4.G <= 145 & clrpoint4.B <= 145)
flag += 8;
str += getStringCharByFlag(flag);
flag = 0;
Color clrpoint5 = bitmap.GetPixel(28, 3);
if (clrpoint5.R <= 145 & clrpoint5.G <= 145 & clrpoint5.B <= 145)
flag += 1;
Color clrpoint6 = bitmap.GetPixel(27, 5);
if (clrpoint6.R <= 145 & clrpoint6.G <= 145 & clrpoint6.B <= 145)
flag += 2;
Color clrpoint7 = bitmap.GetPixel(30, 8);
if (clrpoint7.R <= 145 & clrpoint7.G <= 145 & clrpoint7.B <= 145)
flag += 4;
Color clrpoint8 = bitmap.GetPixel(31, 14);
if (clrpoint8.R <= 145 & clrpoint8.G <= 145 & clrpoint8.B <= 145)
flag += 8;
str += getStringCharByFlag(flag);
flag = 0;
Color clrpoint9 = bitmap.GetPixel(43, 3);
if (clrpoint9.R <= 145 & clrpoint9.G <= 145 & clrpoint9.B <= 145)
flag += 1;
Color clrpoint10 = bitmap.GetPixel(42, 5);
if (clrpoint10.R <= 145 & clrpoint10.G <= 145 & clrpoint10.B <= 145)
flag += 2;
Color clrpoint11 = bitmap.GetPixel(45, 8);
if (clrpoint11.R <= 145 & clrpoint11.G <= 145 & clrpoint11.B <= 145)
flag += 4;
Color clrpoint12 = bitmap.GetPixel(46, 14);
if (clrpoint12.R <= 145 & clrpoint12.G <= 145 & clrpoint12.B <= 145)
flag += 8;
str += getStringCharByFlag(flag);
flag = 0;
Color clrpoint13 = bitmap.GetPixel(58, 3);
if (clrpoint13.R <= 145 & clrpoint13.G <= 145 & clrpoint13.B <= 145)
flag += 1;
Color clrpoint14 = bitmap.GetPixel(57, 5);
if (clrpoint14.R <= 145 & clrpoint14.G <= 145 & clrpoint14.B <= 145)
flag += 2;
Color clrpoint15 = bitmap.GetPixel(60, 8);
if (clrpoint15.R <= 145 & clrpoint15.G <= 145 & clrpoint15.B <= 145)
flag += 4;
Color clrpoint16 = bitmap.GetPixel(61, 14);
if (clrpoint16.R <= 145 & clrpoint16.G <= 145 & clrpoint16.B <= 145)
flag += 8;
str += getStringCharByFlag(flag);
return str;
}
private string getStringCharByFlag(int flag)
{
string ret;
switch (flag)
{
case 12:
ret = "1";
break;
case 9:
ret = "2";
break;
case 13:
ret = "3";
break;
case 0:
ret = "4";
break;
case 7:
ret = "5";
break;
case 14:
ret = "6";
break;
case 1:
ret = "7";
break;
case 15:
ret = "8";
break;
case 11:
ret = "9";
break;
case 10:
ret = "0";
break;
default:
ret = "?";
break;
}
return ret;
}
只适用于简单验证码识别,复杂的要用更难的算法,不会再问我追问把能识别复杂验证码的源码文件发我邮箱,谢了!