为什么Tesseract OCR在使用C#3.5的Asp.net中不起作用? [英] Why Tesseract OCR is not working in Asp.net with C#3.5?

查看:108
本文介绍了为什么Tesseract OCR在使用C#3.5的Asp.net中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Tesseract OCR在使用C#3.5的Asp.net中无效?我能够在c#应用程序中从扫描图像中提取文本。但是在Web应用程序中使用同样不起作用。这里的OCR.Init方法在Asp.net中不起作用,但在windows应用程序中没有这样的问题。我在bin目录下设置了tessdata文件夹,并且还添加了tesseract bll作为参考。

我的代码如下:

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:

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;
     }
 }

推荐答案

试试这个.Net wrapper [ ^ ]推荐人 Tesseract-OCR [ ^ ]。您可以找到一个优秀的 OCR网络演示 [ ^ ]里面。
Try this .Net wrapper[^] which recommended by Tesseract-OCR[^]. You can find an excellent OCR web demo[^] inside.


这篇关于为什么Tesseract OCR在使用C#3.5的Asp.net中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆