Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Why Tesseract OCR is not working in Asp.net with C#3.5? I am able to extract the text from the scanned image in c# application. But while using in web application the same is not working. Here OCR.Init method its not working in Asp.net but in windows application there are no such issues.I have set the tessdata folder under bin directory and tesseract bll also has been added as reference.
My code is as follows:
C#
string Results = string.Empty;

 string path = @"D:\OCR\test.jpg";
 // string path = Server.MapPath("~/Images/test.jpg");
 Bitmap image = new Bitmap(path);
 tessnet2.Tesseract ocr = new tessnet2.Tesseract();
 ocr.Init(null, "eng", false); // To use correct tessdata
 
 //To recognise the text in the selected image area (x cordinate,y cordinate,width,height)
 if (rdSelectedAreaTextImage.Checked == true)
 {
     int xCoordinate = int.Parse(txtXCooridnate.Text);
     int yCoordinate = int.Parse(txtYCooridnate.Text);

     List<tessnet2.Word> r1 = ocr.DoOCR(image, new Rectangle(xCoordinate, yCoordinate, 1187, 623));
     foreach (tessnet2.Word word in r1)
     //if (word.Text.Contains("About"))
     {
         // Console.WriteLine("{0} : {1}", word.Confidence, word.Text);
         Results += word.Text;
     }
 }
Posted
Updated 25-Nov-14 3:24am
v2
Comments
Sergey Alexandrovich Kryukov 25-Nov-14 10:14am    
This is a wrapper using tesseract dll (dlls). The problem could be the location or file name(s) of the tesseract module(s)... Tesseract was found in one of your applications and no in another. This is just the speculation...
—SA
pandu rangarao 11-Dec-14 11:33am    
can you plz provide me the code hence i will try for that

1 solution

Try this .Net wrapper[^] which recommended by Tesseract-OCR[^]. You can find an excellent OCR web demo[^] inside.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900