2013-04-05 143 views
1

我想在c#应用程序中使用tessnet2从图像中读取文本。 这是我的代码:Tessnet2 OCR只返回数字

string valoare=""; 
lblOCR.Text = ""; 

Bitmap image = new Bitmap(@"C:\Stamp\test.png"); 
tessnet2.Tesseract ocr = new tessnet2.Tesseract(); 
ocr.Init(@"F:\Manipulare pdf\bin(1)\Release32\tessdata", "eng", false); 
var rect = new System.Drawing.Rectangle(); 
List<tessnet2.Word> result = ocr.DoOCR(image, rect); 

int lc = tessnet2.Tesseract.LineCount(result); 
foreach (tessnet2.Word word in result) 
{ 
lblOCR.Text += word.Text+" "+word.Confidence+"<br/>"; 
} 

所得字符串只包含数字,但我的图片中包含的字母,我不明白为什么。

谢谢

+0

可能与图像的方向有关吗?我不知道他们是否为C#封装实现了“自动”方向,我知道它是在C++源代码中。...... – devHead 2013-04-05 13:55:57

回答

0

尝试再次放入语言包。

Tessnet2适用于语言包2及以上。

+0

这样做的窍门,谢谢。 – roroinpho21 2013-04-05 14:10:46