依赖下载
Tesseract
目录结构
语言包下载地址 : github.com/tesseract-o…
相关代码
using Tesseract;
string path = "Z:\ocr\tessdata";
TesseractEngine engine = new TesseractEngine(path, "eng");
Tesseract.Pix pix = Tesseract.Pix.LoadFromFile(path + "\" + "01.png");
Tesseract.Page page = engine.Process(pix);
string result = page.GetText();
Console.WriteLine(result);
测试
优化
using Tesseract;
string path = "Z:\ocr\tessdata";
using (TesseractEngine engine = new TesseractEngine(path, "eng"))
{
Tesseract.Pix pix = Tesseract.Pix.LoadFromFile(path + "\" + "02.png");
Tesseract.Page page = engine.Process(pix);
string result = page.GetText();
Console.WriteLine(result);
}