I have compiled now the tesseract library, with cppan.

and I have found a test app, with this source code:

/*
dependencies:
    pvt.cppan.demo.google.tesseract.libtesseract: master
    pvt.cppan.demo.danbloomberg.leptonica: 1
*/

#include <iostream>
#include <memory>

#include <allheaders.h> // leptonica main header for image io
#include <baseapi.h> // tesseract main header

int main(int argc, char *argv[])
{
// if (argc == 1)
// return 1;

tesseract::TessBaseAPI tess;

if (tess.Init("./tessdata", "eng"))
{
std::cout << "OCRTesseract: Could not initialize tesseract." << std::endl;
return 1;
}

// setup
tess.SetPageSegMode(tesseract::PageSegMode::PSM_AUTO);
tess.SetVariable("save_best_choices", "T");

// read image
auto pixs = pixRead(argv[1]);
if (! pixs)
{
std::cout << "Cannot open input file: " << argv[1] << std::endl;
return 1;
}

// recognize
tess.SetImage(pixs);
tess.Recognize(0);

// get result and delete[] returned char* string
std::cout << std::unique_ptr<char[]>(tess.GetUTF8Text()).get() << std::endl;

// cleanup
tess.Clear();
pixDestroy(&pixs);

return 0;
}

and when I am trying to run this, I got:

Error opening data file ./tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to your 
"tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
OCRTesseract: Could not initialize tesseract.

There is not enough to compile tesseract and dependencies, what else should 
I setup in order to run this code in a VC++ project ?



On Monday, October 29, 2018 at 7:50:05 PM UTC+2, zdenop wrote:
>
> I already gave you step by step instructions (the same as on the wiki ;-) 
> but just commands you need to write).
> You replied that is does not work for you without any explanation what 
> does not work. With this state of mind I do not know how to help you.
>
>
>
>
> Zdenko
>
>
> po 29. 10. 2018 o 14:17 <flavi...@gmail.com <javascript:>> napísal(a):
>
>>     Hi Zdenko. Could you send me a example (from a link, or from 
>> something) to reveal me how to compile Tesseract 4 in order to use it in a 
>> VC++ project ? I have a task to do that, and my time is running out, and I 
>> haven't found a functional and working sample of how to do that ... I guess 
>> you already have a project that using Tesseract in VC++ ... I will be 
>> grateful for any hint to lead me for solving my task.
>>
>> Regards,
>> Flaviu.
>>
>>
>> On Sunday, September 30, 2018 at 8:50:59 PM UTC+3, zdenop wrote:
>>>
>>> RC 1[1] ready.
>>> Please test, test, test. Especially if you are wrapping tesseract and 
>>> creating/providing packages.
>>> Report problems ASAP in issue tracker, so we can fix it until finale 
>>> release.
>>>
>>> [1] https://github.com/tesseract-ocr/tesseract/tree/4.0.0-rc1
>>>
>>>
>>> Zdenko
>>>
>>>
>>> so 22. 9. 2018 o 17:06 Zdenko Podobny <zde...@gmail.com> napísal(a):
>>>
>>>> Hello,
>>>>
>>>> I would like to thank all who share their thought about releasing new 
>>>> version of tesseract [1]. I took my time and I decided we should make 
>>>> release at the middle October 2018 (14-21...).
>>>>
>>>> This should means that no new features will be applied to current code. 
>>>> There is not time for testings. Anyway please feel free to send your 
>>>> patch/PR - it will included after 4.0 release.
>>>>
>>>> There are several ways, how people can contribute to this process:
>>>>
>>>>    - *Developers*: go through open issues, try to fix it. Please make 
>>>>    a comment when you start do deal with issue, so we can use our capacity 
>>>>    efficiently.
>>>>    - *Packagers*: please test if building and packaging process is 
>>>>    working fine. If something is broken, try to fix&submit it fast. Please 
>>>>    give a note to forum or me directly, where users can find your 
>>>> "product", 
>>>>    so we can put information about supported systems to release notes.
>>>>    - *"Wrappers"*: if you are producing wrapper for tesseract, please 
>>>>    give a note to forum or me directly if you support tesseract 4: I would 
>>>>    like to promote your work. 
>>>>    - *"No code" developers*:
>>>>       - check open issues, test it with the latest code if it still 
>>>>       valid report, prepare test case if missing, report duplicates, 
>>>> suggest 
>>>>       label etc.
>>>>       - Improve documentation, release notes, man pages etc...
>>>>       - English native speaker: check documentation, release notes etc.
>>>>    
>>>> Thanks to all who help us to get to this point. I really appreciate all 
>>>> ways of support.
>>>>
>>>> [1] https://github.com/tesseract-ocr/tesseract/issues/1423
>>>>
>>>> Zdenko
>>>>
>>> -- 
>> 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 <javascript:>.
>> To post to this group, send email to tesser...@googlegroups.com 
>> <javascript:>.
>> 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/0ec238c8-f9ba-4d49-bd7f-c31beb66377a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tesseract-ocr/0ec238c8-f9ba-4d49-bd7f-c31beb66377a%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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-ocr+unsubscr...@googlegroups.com.
To post to this group, send email to tesseract-ocr@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/0491cb8d-c8d1-476f-a017-07c3edf23638%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to