https://github.com/tesseract-ocr/tessdata
新建控制台项目并添加包
Tesseract
和Tesseract.Drawing
下载训练的模型
代码实现
cs
using Tesseract;
var filePath = "F:\\Desktop\\韦小宝.png";
var exePath = AppDomain.CurrentDomain.BaseDirectory;
var language = "chi_sim";
var engine = new TesseractEngine(Path.Combine(exePath,"tessdata"), language, EngineMode.Default);
using (var img = Pix.LoadFromFile(filePath))
{
using (var page = engine.Process(img))
{
Console.WriteLine(page.GetText());
Console.WriteLine($"置信度:{page.GetMeanConfidence()}");
}
}
识别精度有点低,需要结合opencv处理提高精度