将tesseract库与QtCreator链接
Link tesseract libs with QtCreator
我正在尝试运行一个基于tesseract API的C++程序,并在Ubuntu上使用QtCreator作为IDE,以便进行页面布局分析:
int main(void)
{
int left, top, right, bottom;
tesseract::TessBaseAPI tessApi;
tessApi.InitForAnalysePage();
cv::Mat img = cv::imread("document.png");
tessApi.SetImage(reinterpret_cast<const uchar*>(img.data), img.size().width, img.size().height, img.channels(), img.step1());
tesseract::PageIterator *iter = tessApi.AnalyseLayout();
while (iter->Next(tesseract::RIL_BLOCK))
iter->BoundingBox( tesseract::RIL_BLOCK, &left, &top, &right, &bottom);
return EXIT_SUCCESS;
}
但反过来,我得到了这些错误,证实tesseract和Qt没有联系:
main.cpp:11: error: undefined reference to `tesseract::TessBaseAPI::TessBaseAPI()'
main.cpp:12: error: undefined reference to `tesseract::TessBaseAPI::InitForAnalysePage()'
main.cpp:16: error: undefined reference to `tesseract::TessBaseAPI::SetImage(unsigned char const*, int, int, int, int)'
main.cpp:18: error: undefined reference to `tesseract::TessBaseAPI::AnalyseLayout()'
这是我的.pro文件:
INCLUDEPATH += /usr/local/include/opencv
/usr/include/tesseract
LIBS += -L"/usr/local/opencv/lib" -lopencv_calib3d
-lopencv_contrib
-lopencv_core
-lopencv_features2d
-lopencv_flann
-lopencv_gpu
-lopencv_highgui
-lopencv_imgproc
-lopencv_legacy
-lopencv_ml
-lopencv_nonfree
-lopencv_objdetect
-lopencv_ocl
-lopencv_photo
-lopencv_stitching
-lopencv_superres
-lopencv_video
-lopencv_videostab
LIBS += -L"/usr/bin/tesseract"
您只有库-L"/usr/bin/tesseract"
的路径,您也忘记了包含库。只需像添加openCV库一样添加它。
相关文章:
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- CMake-按正确顺序将项目与C运行时对象文件链接
- 从链接列表c++中删除一个项目
- 有根的二进制搜索树.保留与其父级的链接
- 读取文件的最后一行并输入到链接列表时出错
- QtCreator with C 库中的链接器问题
- 如何使用QtCreator将应用程序与"libqsqlpsql.so"链接?
- QTCreator,子标记链接器错误
- 将TBB库与QTCreator与CMAKE项目链接
- MySql connector-c++不会在QtCreator中链接,但在Raspberry pi3上本地工作正常
- 在QtCreator中链接dll的未定义引用错误
- Windows上的QtCreator中的链接问题
- 如何使Qt和Qtcreator静态链接库而不是动态链接库
- 将tesseract库与QtCreator链接
- 无法将 glfw 与 Ubuntu 中的 QtCreator 中的 CMake 链接
- 在windows上,链接器忽略qtcreator中的/openmp
- 在QtCreator中链接SDL2
- 如何在QtCreator中链接opencv并使用Qt库
- 链接/使用QtCreator中的外部库
- 使用QTCreator.pro文件中的QMAKE链接标志顺序