Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Tesseract libraries on Qt 5.7 Mingw32 in Windows
Forum Updated to NodeBB v4.3 + New Features

Tesseract libraries on Qt 5.7 Mingw32 in Windows

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 4.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FED27
    wrote on last edited by FED27
    #1

    Hi, i'm trying to build the tesseract ocr libraries in order to use these on qt 5.7. I've found only this link tutorial but when i try to launch, at the end, the code qt says me that:

    Starting C:\Users\fed_2\Documents\build-Prova_tsr-Desktop_Qt_5_7_1_MinGW_32bit-Debug\debug\Interfaccia.exe...
    The program has unexpectedly finished.
    C:\Users\fed_2\Documents\build-Prova_tsr-Desktop_Qt_5_7_1_MinGW_32bit-Debug\debug\Interfaccia.exe crashed.

    has anyone ever used these libraries on QT and is able to explain how to install correctly?

    Thank you

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you show a stack trace ?

      By the way, where are the Tesseract .dlls located ?

      Depending on that, you should modify the PATH environment variable in the Run part of the Project panel to contain also the folder to them.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • F Offline
        F Offline
        FED27
        wrote on last edited by
        #3

        All the libraries are built following the tutorial in the link that i show in the main post.
        The .pro file is that:

        SOURCES += main.cpp\
        
        
        INCLUDEPATH+=C:\\new\\include
         LIBS +=-LC:\\new\\lib \
                    -ltesseract.dll\
                    -llept.dll
        
        INCLUDEPATH+=C:\\OpenCV3.0\\opencv_bin\\install\\include
        
        LIBS+=-LC:\\OpenCV3.0\\opencv_bin\\bin\
        -lopencv_calib3d320d \
        -lopencv_core320d\
        -lopencv_features2d320d\
        -lopencv_flann320d\
        -lopencv_highgui320d\
        -lopencv_imgcodecs320d\
        -lopencv_imgproc320d\
        -lopencv_ml320d\
        -lopencv_objdetect320d\
        -lopencv_photo320d\
        -lopencv_shape320d\
        -lopencv_stitching320d\
        -lopencv_superres320d\
        -lopencv_video320d\
        -lopencv_videoio320d\
        -lopencv_videostab320d
        
        
        
        

        and the main file

        
        #include <tesseract/baseapi.h>
        #include <tesseract/strngs.h>
        #include <iostream>
        
        int main(int argc, char** argv)
        {
        
        
        const char* lang = "eng";
        const char* filename = "C:/immagini/nn.jpg";
        
        tesseract::TessBaseAPI tess;
        tess.Init(NULL, lang, tesseract::OEM_DEFAULT);
        tess.SetPageSegMode(tesseract::PSM_SINGLE_BLOCK);
        
        FILE* fin = fopen(filename, "rb");
        if (fin == NULL)
        {
        std::cout << "Cannot open " << filename << std::endl;
        return -1;
        }
        fclose(fin);
        
        STRING text;
        if (!tess.ProcessPages(filename, NULL, 0, &text))
        {
        std::cout << "Error during processing." << std::endl;
        return -1;
        }
        else
        std::cout << text.string() << std::endl;
        
        return 0;
        }
        
        
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          But you likely have a runtime problem hence my question of location of the .dlls. Did you modify the PATH environment variable in Qt Creator like I suggested ? Otherwise your application won't find the tesseract nor the OpenCV .dlls file thus it won't be able to start.

          Note that your tesseract link lines look wrong, they should be like the OpenCV ones.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • F Offline
            F Offline
            FED27
            wrote on last edited by
            #5

            Yes i've
            I checked the PATH environment and the path is there. The .pro file works for the opencv libraries but when it calls the "tesseract::TessBaseAPI tess" that line it crashed.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What does the stack trace tells you about that ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved