How to use the tesseract after building the solution?
varun1994varun opened this issue · 2 comments
varun1994varun commented
Hi,
I have successfully build the solution.But when I run the program using the basic api example it shows nothing.I am new into this and not able to figure out what exactly is wrong or Is there any other method to use tesseract?
Thank you.
Basic API example:
#include <tesseract/baseapi.h>
#include <leptonica/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/testing/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;
}
varun1994varun commented
I have found out the solution for the issue.
Dcruise546 commented
Care to explain how did you solve this issue?