OpenCV + Leptonica + Tesseract 项目的 CMakeLists.txt 示例

Posted starudream

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenCV + Leptonica + Tesseract 项目的 CMakeLists.txt 示例相关的知识,希望对你有一定的参考价值。

cmake_minimum_required(VERSION 3.9)
project(A5)
set(CMAKE_CXX_STANDARD 11)

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

find_package(Leptonica REQUIRED)
include_directories(${Leptonica_INCLUDE_DIRS})

find_package(Tesseract REQUIRED)
include_directories(${Tesseract_INCLUDE_DIRS})

add_executable(A5 main.cpp)

target_link_libraries(A5 ${OpenCV_LIBS})
target_link_libraries(A5 ${Leptonica_LIBRARIES})

## If your tesseract is under 4.0.0-beta.1, you need `libtesseract` instead of `${Tesseract_LIBRARIES}`.
## Detail you can see: https://github.com/tesseract-ocr/tesseract/commit/000d027a9f40e17c9a90a907fa9e4a16616e61a0
target_link_libraries(A5 libtesseract)
#target_link_libraries(A5 ${Tesseract_LIBRARIES})

以上是关于OpenCV + Leptonica + Tesseract 项目的 CMakeLists.txt 示例的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu 16.04 安装 Leptonica 1.75.3

Tesseract 加载语言失败 (Tess4j / Java / Netbeans)

Leptonica - 应用 otsu 阈值后无法写入图像

Leptonica 与 Xcode 框架冲突

Leptonica在VS2010中的编译及简单使用举例

使用 leptonica 进行 OCR 图像处理(反色文本)