Using System;
Using System.Collections.Generic;
Using System.Web;
Add using System.Net;
Using System.IO; Using Tessnet2;
Reference Tessnet2_32.dll using System.Drawing;
Using Getcodes;
Using System.Text;
Public partial class OCR:System.Web.UI.Page {protected void Page_Load (object sender, EventArgs e) {
WebRequest request = WebRequest.Create ("http://sz.2zf.cn/js/code2.asp"); WebResponse response = Request.
GetResponse (); Stream st = Response.
GetResponseStream ();
Bitmap Bitmap = (Bitmap) bitmap.fromstream (ST);
Uncodebase ud = new Uncodebase (bitmap); Bitmap = ud.
Graybypixels (); Ud.
Clearnoise (128, 2);
Save Display string Savepath = "~/photos/orc.gif"; Bitmap.
Save (Server.MapPath (Savepath), System.Drawing.Imaging.ImageFormat.Gif);
Image1.imageurl = Savepath; Tessnet2. Tesseract OCR = new Tessnet2. Tesseract ()//declares an OCR class OCR. SetvAriable ("Tessedit_char_whitelist", "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); Set the identification variable//OCR.
Init (NULL, "Eng", false); Ocr. Init (Server.MapPath ("~/language"), "Eng", true); Applies the current language pack. Note that Tessnet2 is supported in Mandarin. Language pack Download Link: http://code.google.com/p/tesseract-ocr/downloads/list list<tessnet2. word> result = OCR. DOOCR (bitmap, rectangle.empty);//Perform recognition operation string code = Result[0].
Text;
Label1.Text = code; }
}