我使用VCPKG工具安装了TESSERACT,并尝试通过创建Visual Studio项目来运行一个小的示例程序,但该程序未运行。
已安装:tesseract:x64-windows-static
已安装:tesseract:x64-windows
更新后的vcpkg
在vcpkg中集成了已安装的库
Visual Studio在“多线程调试DLL”中尝试了其他多线程选项,它给出了更多错误。
Picture shows the errors displayed in Visual studio 2017
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
int main()
{
char *outText;
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
// Initialize tesseract-ocr with English, without specifying tessdata
path
if (api->Init(NULL, "eng")) {
fprintf(stderr, "Could not initialize tesseract.\n");
exit(1);
}
// Open input image with leptonica library
Pix *image = pixRead("example.png");
api->SetImage(image);
// Get OCR result
outText = api->GetUTF8Text();
printf("OCR output:\n%s", outText);
// Destroy used object and release memory
api->End();
delete[] outText;
pixDestroy(&image);
return 0;
}