Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/141.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在ubuntu中使用tesseract 我下载了TESSACT,我想用C++代码使用它。 但我得到了这些错误: TessOp.cpp:6:39: fatal error: tesseract-ocr/api/baseapi.h: No such file or directory_C++_Opencv_Ubuntu_Tesseract - Fatal编程技术网

在ubuntu中使用tesseract 我下载了TESSACT,我想用C++代码使用它。 但我得到了这些错误: TessOp.cpp:6:39: fatal error: tesseract-ocr/api/baseapi.h: No such file or directory

在ubuntu中使用tesseract 我下载了TESSACT,我想用C++代码使用它。 但我得到了这些错误: TessOp.cpp:6:39: fatal error: tesseract-ocr/api/baseapi.h: No such file or directory,c++,opencv,ubuntu,tesseract,C++,Opencv,Ubuntu,Tesseract,在我的代码中,我也使用OpenCV,这是我的代码: #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <tesseract-ocr/api/baseapi.h> #include <iostream> int main(int argc, char** argv) { // Load image cv::Ma

在我的代码中,我也使用OpenCV,这是我的代码:

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <tesseract-ocr/api/baseapi.h>
#include <iostream>

int main(int argc, char** argv)
{
    // Load image
    cv::Mat im = cv::imread("1.png");
    if (im.empty())
    {
        std::cout << "Cannot open source image!" << std::endl;
        return -1;
    }

    cv::Mat gray;
    cv::cvtColor(im, gray, CV_BGR2GRAY);
    // ...other image pre-processing here...
    //Mat binary_image;
    //threshold(gray,binary_image, 25, 255, CV_THRESH_BINARY);
    //imshow("binary_image",binary_image);

    // Pass it to Tesseract API
    tesseract::TessBaseAPI tess;
    //tess.Init("C:/Tesseract-OCR/tessdata/", "eng");
    tess.Init(NULL, "eng", tesseract::OEM_DEFAULT);
    tess.SetPageSegMode(tesseract::PSM_SINGLE_BLOCK);
    tess.SetImage((uchar*)gray.data, gray.cols, gray.rows, 1, gray.cols);

    // Get the text
    char* out = tess.GetUTF8Text();
    std::cout << out << std::endl;

    return 0;
}

您没有添加tesseract的include目录,也没有链接它。 将以下内容添加到命令行

-I/usr/local/include/tesseract -ltesseract

我也面临同样的问题。让我知道如何解决这个问题?
-I/usr/local/include/tesseract -ltesseract