繁体   English   中英

使用QtCreator链接tesseract libs

[英]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"

你只有lib -L"/usr/bin/tesseract"的路径,你也忘了包含lib。 只需像添加openCV库一样添加它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM