Tesseract API ResultIterator错误编译

时间:2015-12-16 09:53:47

标签: c++ ocr tesseract

我想从tesseract中使用ResultIterator,我在APIExample上使用这样的源代码:

Pix *image = pixRead("test.png");
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
api->Init(NULL, "eng");
api->SetImage(image);
api->Recognize(0);
tesseract::ResultIterator* ri = api->GetIterator();
tesseract::PageIteratorLevel level = tesseract::RIL_WORD;
if (ri != 0) {
  do {
    const char* word = ri->GetUTF8Text(level);
    float conf = ri->Confidence(level);
    int x1, y1, x2, y2;
    ri->BoundingBox(level, &x1, &y1, &x2, &y2);
    printf("word: '%s';  \tconf: %.2f; BoundingBox: %d,%d,%d,%d;\n",
           word, conf, x1, y1, x2, y2);
    delete[] word;
  } while (ri->Next(level));
}

但是我编译时遇到了这个错误:

ocr.cpp: In function ‘int main(int, char**)’:
ocr.cpp:82:34: error: invalid use of incomplete type ‘class tesseract::ResultIterator’
In file included from ocr.cpp:10:0:
/usr/include/tesseract/baseapi.h:83:7: error: forward declaration of ‘class tesseract::ResultIterator’
ocr.cpp:83:28: error: invalid use of incomplete type ‘class tesseract::ResultIterator’
In file included from ocr.cpp:10:0:
/usr/include/tesseract/baseapi.h:83:7: error: forward declaration of ‘class tesseract::ResultIterator’
 ocr.cpp:85:15: error: invalid use of incomplete type ‘class tesseract::ResultIterator’
In file included from ocr.cpp:10:0:
/usr/include/tesseract/baseapi.h:83:7: error: forward declaration of ‘class tesseract::ResultIterator’
ocr.cpp:89:20: error: invalid use of incomplete type ‘class tesseract::ResultIterator’
In file included from ocr.cpp:10:0:
/usr/include/tesseract/baseapi.h:83:7: error: forward declaration of ‘class tesseract::ResultIterator’

我的tesseract-ocr-dev版本为3.02.01-6,版本libtesseract-dev为3.02.01-6

0 个答案:

没有答案