可以识别复杂验证码 public void Code() { string code; //************* //URL 识别 code = avc.GetVcodeUrl("http://bbs.ent.163.com/bbs/checkcode.jsp?1201359681906"); Console.WriteLine("URL 识别:" code); //************* //路径识别 code = avc.GetVcodeFile("temp.tmp"); Console.WriteLine("路径识别:" code); //************* FileStream fsMyfile = File.OpenRead("temp.tmp"); int FileLen = (int)fsMyfile.Length; byte[] Buffer = new byte[FileLen]; fsMyfile.Read(Buffer, 0, FileLen); fsMyfile.Close(); //Buffer 识别 code = avc.GetVcodeBuffer(Buffer); Console.WriteLine("Buffer 识别:" code); //************* FileStream fs = File.OpenRead("temp.tmp"); //OpenRead int filelength = 0; filelength = (int)fs.Length; //获得文件长度 byte[] image = new Byte[filelength]; //建立一个字节数组 fs.Read(image, 0, filelength); //按字节流读取 System.Drawing.Image result = System.Drawing.Image.FromStream(fs); fs.Close(); Bitmap bmp = new Bitmap(result); //Bitmap 识别 code = avc.GetVcodeBitmap(bmp); Console.WriteLine("Bitmap 识别:" code); MessageBox.Show("识别结果:" code); }
评论