error in running tesseract with API example

98 views
Skip to first unread message

nick

unread,
May 21, 2018, 3:27:42 AM5/21/18
to tesseract-ocr

hi, i want to run tesseract with this code :

#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;
}


but raised this error:
 

/home/myuser/local/lib/libtesseract.so: undefined reference to `pixaDisplayTiledInColumns'

/home/myuser/local/lib/libtesseract.so: undefined reference to `pixReadFromMultipageTiff'
/home/myuser/local/lib/libtesseract.so: undefined reference to `pixReadMemFromMultipageTiff'
/home/myuser/local/lib/libtesseract.so: undefined reference to `pixGenerateHalftoneMask'
collect2: error: ld returned 1 exit status

anyone could help me how resolve it ?

thanks

nick

unread,
May 21, 2018, 4:14:34 AM5/21/18
to tesseract-ocr
I solved that error.
but now , raised a new error:

Failed loading language 'eng'

Tesseract couldn't load any languages!

Could not initialize tesseract.




how could solve it ?

thanks 

flavi...@gmail.com

unread,
Oct 11, 2018, 5:54:33 AM10/11/18
to tesseract-ocr
How you solved ? Because I have the same errors ... would be very hand full when you write that you solve something, to write how you solved :)

Soumik Ranjan Dasgupta

unread,
Oct 11, 2018, 12:09:44 PM10/11/18
to tesser...@googlegroups.com
Your $TESSDATA_DIR variable is not pointing to the tessdata directory. Please ensure you have the correct tessdata directory pointed to by that variable.

--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/4aa9b453-8d64-452c-93ed-226c45f84590%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Regards,
Soumik Ranjan Dasgupta
Reply all
Reply to author
Forward
0 new messages