我正在尝试在c#应用程序中使用tessnet2从图像中读取文本。这是我的代码:
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/>";
}结果字符串只包含数字,但我的图片包含字母,我不明白为什么。
谢谢
发布于 2013-04-05 22:06:42
尝试再次放入语言包。
Tessnet2适用于语言包2和更高版本。
发布于 2020-04-26 22:52:59
我知道我来晚了。我在别的地方找到了解决方案。
我的ocr设置为只能看到数字。但我发现你没有这样的台词:
ocr.SetVariable("tessedit_char_whitelist", "0123456789"); // If digits only对我来说,删除它起到了关键作用。也许您需要进行类似的配置。
https://stackoverflow.com/questions/15835598
复制相似问题