我是Linux编程的新手,我正在尝试Ubuntu 12.10
使用Tesseract和OpenCV创建一个OCR应用程序.到目前为止,我已经设置tesseract
并OpenCV
在Linux上也遵循了本教程,在本教程中,我发现很容易创建一个文件CMakeList.txt
并在其中链接OpenCV.
现在我正在尝试tesseract-ocr
使用此代码编译库.据我所知,我没有在tesseract-ocr
我的代码之间建立链接,这就是为什么我有错误.
我想要和搜索的是我是否可以在一个文件中链接Tesseract
和OpenCV
使用CMake
,如果可能的话.一个教程会很好,因为我对Linux是全新的.提前致谢
我写了的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文件中,只需添加它们即可.如果有一些令人困惑的事情,请阅读CMake的文件.
注意:要使test-ocr成功运行,您应下载英文数据并将其内容复制到/ share/tessdata中.