0

i want to create a web page in c# in which user uploads an image and get text of image in another textbox on same web page. i used Tessract tutorials for it but it is for windows form application but i want to use it on web page. i Have followed instruction of this link...

http://automatedrevolution.com/blog/?p=34

i used code in my Web Page but it local server stops on specific line. My code is Here:-

System.Drawing.Bitmap imageX = new System.Drawing.Bitmap(FileUpload1.PostedFile.InputStream);
System.Drawing.Bitmap image = AForge.Imaging.Image.Clone(imageX, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
tessnet2.Tesseract ocr = new tessnet2.Tesseract();
ocr.Init(null, "eng", false);
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);

foreach (tessnet2.Word word in result)
{
    TextBox1.Text = TextBox1.Text + word.Text + Environment.NewLine;
} 

My code stops on 4th line. Can Anybody tell me what is the problem. I Pasted tessdata folder into Bin directory.

csharpwinphonexaml
  • 3,659
  • 10
  • 32
  • 63
yash
  • 812
  • 3
  • 12
  • 37
  • Usually u provide an error/exception OR more details. From what u provided us so far result has only 4 matches. I see that DoOCR function has the second parameter Rectangle.Empty... is that the correct parameter? – lauCosma May 01 '14 at 07:51
  • i am not getting any error. the application crashes woth any error. – yash May 01 '14 at 08:44
  • Why don't you try and separate it out to a class library, then you can still test I out in a "separated" way - via a small C# console/forms app calling the class object. Then, if you get it working, then include the class in the Web App (and update the application pool with special permissions for the tessaract part) – Anthony Horne May 01 '14 at 10:17
  • I Applied same code in windows form application and it worked. Now my problem is how to use Tesseract library in aspx website. – yash May 01 '14 at 16:22

1 Answers1

0

The problem is that you need Full Trust on server to put it to work, because your application will execute a dos program (.exe extension). Anyway, fulltrust is not applicable because it lacks security. I'm trying to implement Partial Trust, but without luck.