【发布时间】:2016-04-08 10:07:04
【问题描述】:
iam 使用 tesseract ocr 在 C++ 中读取德语 png 图像,但我遇到了一些特殊字符的问题,例如
ß ä ö ü 等等。
我是否需要训练 tesseract 才能正确阅读此内容或需要做什么?
This is the part of the original image read by tesseract
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
更新
SetConsoleOutputCP(1252);//changed to german.
SetConsoleCP(1252);//changed to german
wcout << "ÄÖÜ?ß" << endl;
// Open input image with leptonica library
Pix *image = pixRead("D:\\Images\\Document.png");
api->Init("D:\\TesseractBeispiele\\Tessaractbeispiel\\Tessaractbeispiel\\tessdata", "deu");
api->SetImage(image);
api->SetVariable("save_blob_choices", "T");
api->SetRectangle(1000, 3000, 9000, 9000);
api->Recognize(NULL);
// Get OCR result
wcout << api->GetUTF8Text());
After changing the Code below the Update 硬编码的变音符号将正确显示,但图像中的文本不正确,我需要更改什么?
tesseract 版本是 3.0.2 leptonica 版本是 1.68
【问题讨论】:
标签: c++ utf-8 console-application tesseract