C#中的Tessnet 2并没有阅读完整的句子。 [英] Tessnet 2 in C# is not reading the complete sentence.
问题描述
请在我的程序中找到以下代码,我在其中配置了tessnet2 tesseract来读取图像。目前代码正在读取图像,但问题是在一个句子中它只读取一个单词意味着它检测到它停止的空间并且它只返回一个单词。请帮助。
例如:如果我的图片有以下句子:
场景1:ABCDEFGHIJKLM(图片文字中没有空格)
结果:ABCDEFGHIJKLM(阅读完整图片)
场景2:ABCDE FGHJKLM(ABCDE之后的空间)
结果:ABCDE(仅读取ABCDE)
请指导如何解决这个问题。
Hi,
Please find the below code is used in my programme where i have configure the tessnet2 tesseract for the reading the images. Presently the code is reading the images but the problem is that in a sentence it will read only one word means while it detect the space it is getting stop and it will return only one word. Kindly help.
Ex : If my image having the following sentences:
scenario 1: ABCDEFGHIJKLM (there is no space in the text of image)
Result : ABCDEFGHIJKLM (Reads the complete image)
scenario 2: ABCDE FGHJKLM (space after the ABCDE)
Result : ABCDE (Reads upto only ABCDE )
Kindly guide how to solve this issue.
Bitmap image = new Bitmap(path+"abcdef.jpg");
Response.Write("<script>alert('converted');</script>");
tessnet2.Tesseract ocr = new tessnet2.Tesseract();
ocr.SetVariable("tessedit_char_whitelist", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 0123456789"); // If digit only
ocr.Init(@"E:\Dotnet\NPR\tessdata", "eng",false); // To use correct tessdata
//List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
foreach (tessnet2.Word word in result)
Console.WriteLine("{0} : {1}", word.Confidence, word.Text);
Console.ReadLine();
Response.Write("<script>alert('compltd');</script>");
Label1.Text= result[0].Text;
// Image1.ImageUrl = path;
推荐答案
你应该和制作此软件包的人员 [ ^ ]。
这篇关于C#中的Tessnet 2并没有阅读完整的句子。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!