【问题标题】:How to integrate tesseract-ocr library in a CMakeLists.txt?如何在 CMakeLists.txt 中集成 tesseract-ocr 库?
【发布时间】:2014-09-21 05:32:21
【问题描述】:

我不知道如何将 tesseract-ocr 库集成到我的 ros 项目中,我使用 qt creator 进行编码并且该库已正确安装,因为 Qtcreator 会自动完成我使用该库的行但此代码无法编译

#include "text_detector.h"
#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <cv_bridge/cv_bridge.h>
#include <sensor_msgs/image_encodings.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <tesseract/baseapi.h>

image_transport::Subscriber sub;
image_transport::Publisher imPub;
ros::Publisher textPub;
tesseract::TessBaseAPI tess;

void onImageReceived(const sensor_msgs::ImageConstPtr& msg){

}

int main (int argc, char* argv[]){
    ros::init(argc,argv,"text_detector");
    ros::NodeHandle nh;
    ROS_INFO_STREAM("Starting text detection");
    image_transport::ImageTransport it(nh);
    imPub = it.advertise("camera_hsv",1);
    tess.Init(NULL,"eng",tesseract::OEM_DEFAULT);
    sub = it.subscribe("camera_raw",1,&onImageReceived);
   // textPub=nh.advertise<>("text",1000);
    ros::spin();
}

出现此编译错误

text_detector.cpp:-1: error: undefined reference to tesseract::TessBaseAPI::TessBaseAPI()' text_detector.cpp:-1: error: undefined reference totesseract::TessBaseAPI::~TessBaseAPI()'

如何将库添加到 CMakeLists.txt 中的项目中? 谢谢!

【问题讨论】:

  • 你的代码/项目在 git 上可用吗?

标签: c++ ocr tesseract ros


【解决方案1】:

看起来您没有链接库。你的CMakeLists.txt 应该包含

target_link_libraries (<YOUR-EXECUTABLE-NAME>  tesseract)

根据您的 CMake 文件,可能只是 ${PROJECT_NAME}

【讨论】:

    猜你喜欢
    • 2012-02-27
    • 1970-01-01
    • 2019-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-17
    • 2016-12-13
    • 1970-01-01
    相关资源
    最近更新 更多