Hi, I'm trying to build some example code from
https://code.google.com/p/tesseract-ocr/wiki/APIExample. I have the following:
#include <tesseract/api/baseapi.h>
#include <leptonica-1.72/src/allheaders.h>
int main()
{
char *outText;
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
// Initialize tesseract-ocr with English, without specifying tessdata path
if (api->Init(NULL, "eng")) {
fprintf(stderr, "Could not initialize tesseract.\n");
exit(1);
}
// Open input image with leptonica library
Pix *image = pixRead("/usr/src/tesseract-3.02/phototest.tif");
api->SetImage(image);
// Get OCR result
outText = api->GetUTF8Text();
printf("OCR output:\n%s", outText);
// Destroy used object and release memory
api->End();
delete [] outText;
pixDestroy(&image);
return 0;
}
I've changed the include commands slightly to help point where the header files actually are on my computer. I compile using:
g++ -I /home/ggdhines/github/ -I /home/ggdhines/github/python-tesseract/vs2008/includes/tesseract/ -I /home/ggdhines/source_code/ tess.cpp
The first two -I's are for tesseract headers, the third is for leptonica.
I then get the following errors:
/home/ggdhines/github/tesseract/api/baseapi.h:96:9: error: ‘TessCallback4’ does not name a type
typedef TessCallback4<const UNICHARSET &, int, PageIterator *, Pix *>
^
/home/ggdhines/github/tesseract/api/baseapi.h:747:26: error: ‘TruthCallback’ has not been declared
void InitTruthCallback(TruthCallback *cb) { truth_cb_ = cb; }
^
/home/ggdhines/github/tesseract/api/baseapi.h:865:3: error: ‘TruthCallback’ does not name a type
TruthCallback *truth_cb_; /// fxn for setting truth_* in WERD_RES
^
/home/ggdhines/github/tesseract/api/baseapi.h: In member function ‘void tesseract::TessBaseAPI::InitTruthCallback(int*)’:
/home/ggdhines/github/tesseract/api/baseapi.h:747:47: error: ‘truth_cb_’ was not declared in this scope
void InitTruthCallback(TruthCallback *cb) { truth_cb_ = cb; }
Any suggestions would be welcome.
Thanks,
Greg Hines