我对Linux编程很陌生,我正在尝试使用Ubuntu 12.10
和OpenCV在特塞尔上创建一个OCR应用程序。到目前为止,我已经在linux上安装了tesseract
和OpenCV
,我也遵循了这个教程,在本教程中,我发现很容易在其中创建一个文件CMakeList.txt
并链接OpenCV。
现在,我正在尝试用tesseract-ocr
编译这段代码库。正如我所知,我没有在tesseract-ocr
和我的代码之间建立链接,这就是为什么我有错误的原因。
我想要的和搜索的是,如果可能的话,我是否可以在一个文件中使用Tesseract
和OpenCV
链接CMake
。一个教程将是很好的,因为我是全新的Linux。提前感谢
发布于 2013-12-04 21:42:07
我写了一个这样的CMakeLists.txt
cmake_minimum_required (VERSION 2.6)
project (test-ocr)
# Add the including directory of the tesseract
# and please replace with your dir.
include_directories (/home/ytxie/include)
# Add the search directory for the tesseract library
# and please replace with your dir.
link_directories (/home/ytxie/lib)
add_executable (test-ocr test.cpp)
# link the leptonica library and the tesseract library
target_link_libraries (test-ocr lept tesseract)
我已经添加了评论,这似乎很容易理解。test.cpp只是那个示例代码。
如果您想要将OpenCV相关设置添加到这个cmake文件中,只需添加它们。如果有一些令人困惑的事情,请阅读科马克文件。
注意:要使测试ocr成功运行,您应该下载英语数据并将其内容复制到/share/tessdata中。
https://stackoverflow.com/questions/20382549
复制