【问题标题】:How to use Tesseract OCR with Cmake on Windows?如何在 Windows 上使用 Tesseract OCR 和 Cmake?
【发布时间】:2020-02-28 03:12:31
【问题描述】:

我正在尝试在 Windows 上的 cmake 项目中使用 tesseract。我安装了 tesseract 5.0 和 tesseract 4.0。他们都没有 cmake 文件夹所以行

find_package(Tesseract REQUIRED)

生产

CMake Error at CMakeLists.txt:14 (find_package):
  By not providing "FindTesseract.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Tesseract", but CMake did not find one.

  Could not find a package configuration file provided by "Tesseract"
  (requested version 4.0) with any of the following names:

    TesseractConfig.cmake
    tesseract-config.cmake

  Add the installation prefix of "Tesseract" to CMAKE_PREFIX_PATH or set
  "Tesseract_DIR" to a directory containing one of the above files.  If
  "Tesseract" provides a separate development package or SDK, be sure it has
  been installed.

但是,在 tesseract 5.0 的安装文件夹中,有 libtesseract-5.dll 和许多其他文件夹。我可以在我的 cmake 项目中链接它们吗?如果是这样,怎么做?为什么安装文件夹中没有包含文件?我应该如何在我的项目中包含 .h 文件?

【问题讨论】:

  • 你是如何安装 tesseract 的?
  • "它们都没有 cmake 文件夹"...这很奇怪。 GitHub repo 显示应该有一个 cmake 文件夹。你是如何安装 tesseract 的?
  • 我猜这个问题只是之前one被问到是同一作者的延续。我想知道这两个问题是否实际上是关于同一个问题
  • @user898678 我通过这里安装:github.com/UB-Mannheim/tesseract/wikicmake 不附带的版本 5.0.0 以及通过这里tesseract-ocr.github.io/tessdoc/… 在“使用 UB Mannheim 的 MinGW-w64 制作的 Windows 安装程序”中cmake也不自带
  • @squareskittles repo里面有个cmake文件夹,不过我觉得是用cmake编译项目的,不是放到安装文件夹里面的文件夹

标签: windows dll cmake shared-libraries tesseract


【解决方案1】:

UB-Mannheim 安装程序是自动工具构建的,它只有 tesseract 的运行时部分(例如可执行文件和链接库)。 您不能将它用于任何开发,因为它不提供所需的文件(库和头文件),因此缺少 cmake 文件是此安装的合理后果。 您可以在安装程序完成的位置详细检查此信息。

【讨论】:

  • 那么如何在 windows 上的 cmake 中使用 tesseract?
  • 你必须从源代码构建它。
【解决方案2】:

您是否尝试过使用 tesseract 的 MSYS/Mingw 构建:pacman -S mingw-w64-x86_64-tesseract-ocr?由于没有 cmake 配置文件,您将不得不使用 pkg_check_modules 代替(另见 cMakefile for using tesseract and opencv 没有 opencv 位)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-12
    • 1970-01-01
    • 1970-01-01
    • 2016-08-15
    • 2015-04-21
    • 1970-01-01
    • 2018-08-09
    相关资源
    最近更新 更多