You need to build tesseract and leptonica by yourself (+ needed
dependencies) with MinGW. If I got it right - you have installed just
runtime libraries, but for creating your app you need libraries useable for
linking (and header files).

I am afraid the same you will need to do with OpenCV, as OpenCV just
provides VS library which is not usable with MinGW[2],[1]
I really doubt this is worthy of time - it is better is to switch to Visual
Studio on Windows (and you still can use Qt Creator)

[1]
https://medium.com/csmadeeasy/opencv-c-installation-on-windows-with-mingw-c0fc1499f39
[2] https://github.com/opencv/opencv/releases

Zdenko


ut 31. 5. 2022 o 18:37 Fish Money <[email protected]> napísal(a):

> I'm usuing mingw + openCV in my current project.
> It has been built for work in QT IDE...
>
> I just need to use OCR into my project and yet, could not find any
> instruction on internet.
> I actually need to run the code below from QT...
>
>
> What are my next steps to make this happen?
> #include <tesseract/baseapi.h>
> #include <leptonica/allheaders.h>
> using namespace std;
>
> 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();
>     cout << ("OCR output:\n%s", outText);
>
>     // Destroy used object and release memory
>     api->End();
>     delete api;
>     delete [] outText;
>     pixDestroy(&image);
>
>     return 0;
> }
> вторник, 31 мая 2022 г. в 22:36:55 UTC+7, zdenop:
>
>> I am not sure why you mentioned SW, as your screenshot indicates you have
>> installed gcc (mingw?) runtime libs:
>>
>> [image: image.png]
>>
>> Do you plan to build your project with mingw? Is opencv built with mingw
>> too? You can not mix VS libraries with mingw libraries...
>> Also another part of your project file looks suspicious:
>>  "LIBS += C:\opencv\release\bin\libopencv_core455.dll"
>> Do you know what are you there? Maybe you should start with a
>> simple project to understand how to use external libraries...
>>
>>
>>
>> Zdenko
>>
>>
>> ut 31. 5. 2022 o 17:00 Fish Money <[email protected]> napísal(a):
>>
>>> I actually stuck, because I could not execute SW and SW_GUI files.
>>> My tesseract folder contains in screen shot attached.
>>>
>>> Dear Zdenko,
>>> Is there any chance we can talk via WhatsApp?
>>> Stuck so bad here in my project...
>>> You gonna save my life :D
>>>
>>> вторник, 31 мая 2022 г. в 13:56:32 UTC+7, zdenop:
>>>
>>>> INCLUDEPATH += /usr/include/tesseract
>>>>
>>>> This does not seem correct on windows.
>>>>
>>>> error: tesseract/baseapi.h: No such file or directory
>>>>
>>>> So you have installed tesseract header files?
>>>>
>>>> You did not mention which compiler you used: "*.dll" indicates Visual
>>>> studio, but what is in "C:\Program Files(x86)\Tesseract-OCR"?
>>>>
>>>> Zdenko
>>>>
>>>>
>>>> po 30. 5. 2022 o 11:19 Fish Money <[email protected]> napísal(a):
>>>>
>>>>> Hello! How can i amend the pro file to make the program work?
>>>>>
>>>>> Googled a lot about QT and Tesseract, could not find a solution yet.
>>>>>
>>>>> QT += core
>>>>> QT -= gui
>>>>>
>>>>> CONFIG += c++11
>>>>>
>>>>> TARGET = openCV
>>>>> CONFIG += console
>>>>> CONFIG -= app_bundle
>>>>>
>>>>> TEMPLATE = app
>>>>> INCLUDEPATH += C:\opencv\release\install\include
>>>>>
>>>>> LIBS += C:\opencv\release\bin\libopencv_core455.dll
>>>>> LIBS += C:\opencv\release\bin\libopencv_highgui455.dll
>>>>> LIBS += C:\opencv\release\bin\libopencv_imgcodecs455.dll
>>>>> LIBS += C:\opencv\release\bin\libopencv_imgproc455.dll
>>>>> LIBS += C:\opencv\release\bin\libopencv_calib3d455.dll
>>>>> LIBS += C:\opencv\release\bin\libopencv_features2d455.dll
>>>>> LIBS += C:\opencv\release\bin\libopencv_video455.dll
>>>>> LIBS += C:\opencv\release\bin\libopencv_videoio455.dll
>>>>> LIBS += -L"(C:\Program Files(x86)\Tesseract-OCR)" -ltesseract
>>>>>
>>>>> INCLUDEPATH += /usr/include/tesseract
>>>>>
>>>>> INCLUDEPATH += C:\Program Files(x86)\Tesseract-OCR)
>>>>>
>>>>> LIBS += C:\Program Files(x86)\Tesseract-OCR)
>>>>>
>>>>> LIBS +=-LC:\Program Files(x86)\Tesseract-OCR)
>>>>> -ltesseract.dll
>>>>> -llept.dll
>>>>>
>>>>> LIBS += -LC:\Qt\opencv_cv2\OPENCV1\build-qt\lib
>>>>> -lopencv_calib3d249d
>>>>> -lopencv_contrib249d
>>>>> -lopencv_core249d
>>>>> -lopencv_features2d249d
>>>>> -lopencv_flann249d
>>>>> -lopencv_gpu249d
>>>>> -lopencv_highgui249d
>>>>> -lopencv_imgproc249d
>>>>> -lopencv_legacy249d
>>>>> -lopencv_ml249d
>>>>> -lopencv_nonfree249d
>>>>> -lopencv_objdetect249d
>>>>> -lopencv_ocl249d
>>>>> -lopencv_photo249d
>>>>> -lopencv_stitching249d
>>>>> -lopencv_superres249d
>>>>> -lopencv_ts249d
>>>>> -lopencv_video249d
>>>>> -lopencv_videostab249d
>>>>>
>>>>> SOURCES += main.cpp
>>>>>
>>>>> DEFINES += QT_DEPRECATED_WARNINGS
>>>>>
>>>>> Errors:
>>>>>
>>>>>
>>>>> still saying D:\PROG\May\Tesseract\main.cpp:1: error:
>>>>> tesseract/baseapi.h: No such file or directory
>>>>> D:\PROG\May\Tesseract\main.cpp:1:10: fatal error: tesseract/baseapi.h:
>>>>> No such file or directory
>>>>> 1 | #include <tesseract/baseapi.h>
>>>>> | ^~~~~~~~~~~~~~~~~~~~~
>>>>>
>>>>>
>>>>> Might be incorrect install, because SW file and SW gui could not be
>>>>> executed.
>>>>>
>>>>> Strongly need advice!
>>>>>
>>>>> --
>>>>> 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 [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/tesseract-ocr/923f5b9b-def7-4171-9ac6-d342a3a99dc9n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/tesseract-ocr/923f5b9b-def7-4171-9ac6-d342a3a99dc9n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> 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 [email protected].
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/tesseract-ocr/71657717-96de-4d45-8e8c-68b9470b24f4n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tesseract-ocr/71657717-96de-4d45-8e8c-68b9470b24f4n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tesseract-ocr/eb46e820-7667-4ff3-88bf-d9aecac1de20n%40googlegroups.com
> <https://groups.google.com/d/msgid/tesseract-ocr/eb46e820-7667-4ff3-88bf-d9aecac1de20n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8w4SvTxT_c_1EN6Ovunrbz4cSRaTrB3s294BKDq%3DKJNOQ%40mail.gmail.com.

Reply via email to