Thank you very much! Now for me it works exactly like from terminal. Cheers, Elena
2014-07-05 0:05 GMT+02:00 zdenko podobny <[email protected]>: > check this[1] - it works for me on openSUSE 13.1 64bit with tesseract > 3.02.02 and gcc 4.8.1 (even the result is not the same as for command line > ;-) ; > > [1] http://pastebin.com/qxUPEQZm > > Zdenko > > > On Fri, Jul 4, 2014 at 2:50 PM, elena bresciani < > [email protected]> wrote: > >> I'm using tesseract 3.02.02 >> and compiling with gcc 4.8.2 >> >> >> 2014-07-04 14:43 GMT+02:00 zdenko podobny <[email protected]>: >> >>> what is your version of tesseract? >>> what kind and version of compiler you use? >>> >>> Zdenko >>> >>> >>> On Fri, Jul 4, 2014 at 12:53 PM, elena bresciani < >>> [email protected]> wrote: >>> >>>> I'm trying modify the code like you said but now I have problems with >>>> GenricVector. >>>> >>>> I have included >>>> <tesseract/genericvector.h> >>>> >>>> and then wrote my code as in the example you cited >>>> >>>> GenericVector pars_vec; >>>> .. >>>> GenericVector pars_values; >>>> .. >>>> >>>> But it doesn't compile and I get this error: >>>> >>>> OCR-0.1.cpp: In function ‘int main(int, char**)’: >>>> OCR-0.1.cpp:9:19: error: missing template arguments before ‘pars_vec’ >>>> GenericVector pars_vec; >>>> ^ >>>> OCR-0.1.cpp:9:19: error: expected ‘;’ before ‘pars_vec’ >>>> OCR-0.1.cpp:10:5: error: ‘pars_vec’ was not declared in this scope >>>> pars_vec.push_back("load_system_dawg"); >>>> ^ >>>> OCR-0.1.cpp:15:19: error: missing template arguments before >>>> ‘pars_values’ >>>> GenericVector pars_values; >>>> ^ >>>> OCR-0.1.cpp:15:19: error: expected ‘;’ before ‘pars_values’ >>>> OCR-0.1.cpp:16:5: error: ‘pars_values’ was not declared in this scope >>>> pars_values.push_back("F"); >>>> ^ >>>> >>>> >>>> what am I missing again? >>>> >>>> >>>> 2014-07-04 11:00 GMT+02:00 zdenko podobny <[email protected]>: >>>> >>>>> I see the problem (there may be also something else ;-) as I do not >>>>> have time to test it yet): >>>>> load_system_dawg, load_freq_dawg etc. are init parameters[1] - you >>>>> try it set them later they are ignored >>>>> You need to pass them to init (see section Tesseract-OCR API[2]) >>>>> >>>>> [1] >>>>> https://code.google.com/p/tesseract-ocr/wiki/ControlParams#Init_only >>>>> [2] http://www.sk-spell.sk.cx/tesseract-ocr-parameters-in-302-version >>>>> >>>>> Zdenko >>>>> >>>>> >>>>> On Fri, Jul 4, 2014 at 9:39 AM, elena bresciani < >>>>> [email protected]> wrote: >>>>> >>>>>> Here's an example of the kind of text that I have to read >>>>>> >>>>>> >>>>>> Il giorno venerdì 4 luglio 2014 09:22:09 UTC+2, zdenop ha scritto: >>>>>>> >>>>>>> Could you please post also testing image? >>>>>>> >>>>>>> Zdenko >>>>>>> >>>>>>> >>>>>>> On Thu, Jul 3, 2014 at 12:22 PM, elena bresciani < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> Dear all, >>>>>>>> >>>>>>>> I need to integrate Tesseract in a C++ project. >>>>>>>> First I simply called Tesseract from command line and, after >>>>>>>> setting up a spefic configuration I've come to satifying results. >>>>>>>> >>>>>>>> This is the config file "pharma" >>>>>>>> >>>>>>>> load_system_dawg 0 >>>>>>>>> load_freq_dawg 0 >>>>>>>>> load_punc_dawg 0 >>>>>>>>> user_words_suffix pharma-words >>>>>>>>> tessedit_char_whitelist abcdefghijklmnopqrstuvwxyzABCD >>>>>>>>> EFGHIJKLMNOPQRSTUVWXYZ0123456789, >>>>>>>>> language_model_penalty_non_dict_word 0 >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Now that I have to do the same thing with a Tesseract API I have >>>>>>>> terrible results, like down to 10% of correct identification and 90% >>>>>>>> garbage. >>>>>>>> I must be missing something in the conversion to the API... >>>>>>>> >>>>>>>> This is my code >>>>>>>> >>>>>>>> #include <tesseract/baseapi.h> >>>>>>>>> #include <leptonica/allheaders.h> >>>>>>>>> >>>>>>>>> int main(int argc, char *argv[]) >>>>>>>>> { >>>>>>>>> char *outText; >>>>>>>>> >>>>>>>>> tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI(); >>>>>>>>> >>>>>>>>> api -> Init("/usr/local/share/","ita"); >>>>>>>>> api -> ReadConfigFile ("pharma"); >>>>>>>>> >>>>>>>>> >>>>>>>>> Pix *image = pixRead (argv[1]); >>>>>>>>> api -> SetImage (image); >>>>>>>>> api -> SetSourceResolution(600); >>>>>>>>> >>>>>>>>> outText = api -> GetUTF8Text(); >>>>>>>>> printf ("OCR output: \n%s", outText); >>>>>>>>> >>>>>>>>> api -> End(); >>>>>>>>> delete [] outText; >>>>>>>>> pixDestroy (&image); >>>>>>>>> >>>>>>>>> return 0; >>>>>>>>> >>>>>>>>> } >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Can somebody help me undestand please? >>>>>>>> >>>>>>>> Thanks in advance >>>>>>>> >>>>>>>> Elena >>>>>>>> >>>>>>>> -- >>>>>>>> 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 post to this group, send email to [email protected]. >>>>>>>> >>>>>>>> Visit this group at http://groups.google.com/group/tesseract-ocr. >>>>>>>> To view this discussion on the web visit >>>>>>>> https://groups.google.com/d/msgid/tesseract-ocr/7dd534f7- >>>>>>>> 3e85-480f-bb81-3d34c7af0c05%40googlegroups.com >>>>>>>> <https://groups.google.com/d/msgid/tesseract-ocr/7dd534f7-3e85-480f-bb81-3d34c7af0c05%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 [email protected]. >>>>>> >>>>>> To post to this group, send email to [email protected]. >>>>>> Visit this group at http://groups.google.com/group/tesseract-ocr. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/tesseract-ocr/27ca8616-1f88-4430-af01-fc4c7c71a3d9%40googlegroups.com >>>>>> <https://groups.google.com/d/msgid/tesseract-ocr/27ca8616-1f88-4430-af01-fc4c7c71a3d9%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 a topic in the >>>>> Google Groups "tesseract-ocr" group. >>>>> To unsubscribe from this topic, visit >>>>> https://groups.google.com/d/topic/tesseract-ocr/bHlfRbg4Fhs/unsubscribe >>>>> . >>>>> To unsubscribe from this group and all its topics, send an email to >>>>> [email protected]. >>>>> >>>>> To post to this group, send email to [email protected]. >>>>> Visit this group at http://groups.google.com/group/tesseract-ocr. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8zJMk8FAAhLawxAmOFJGRy8UEvLFPTa9RRcArrhd4v%2Bhg%40mail.gmail.com >>>>> <https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8zJMk8FAAhLawxAmOFJGRy8UEvLFPTa9RRcArrhd4v%2Bhg%40mail.gmail.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 [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/group/tesseract-ocr. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/tesseract-ocr/CACxk%3DWxXiHL51XtMUmYM7WgPkL4nSyHft%3DzjM8OtRKivq_BXyQ%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/tesseract-ocr/CACxk%3DWxXiHL51XtMUmYM7WgPkL4nSyHft%3DzjM8OtRKivq_BXyQ%40mail.gmail.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 a topic in the >>> Google Groups "tesseract-ocr" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/tesseract-ocr/bHlfRbg4Fhs/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/tesseract-ocr. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8yAthpv1CQO4X%2Bhb%3DNCthay7PEQBatmJ%2BUKt4vTwbXHgw%40mail.gmail.com >>> <https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8yAthpv1CQO4X%2Bhb%3DNCthay7PEQBatmJ%2BUKt4vTwbXHgw%40mail.gmail.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 [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/tesseract-ocr. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/tesseract-ocr/CACxk%3DWyZw_MEiNSuD_SxuZXeJwf03B-yptrQ3AiiX0k12B4cKg%40mail.gmail.com >> <https://groups.google.com/d/msgid/tesseract-ocr/CACxk%3DWyZw_MEiNSuD_SxuZXeJwf03B-yptrQ3AiiX0k12B4cKg%40mail.gmail.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 a topic in the > Google Groups "tesseract-ocr" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/tesseract-ocr/bHlfRbg4Fhs/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/tesseract-ocr. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8xGRpqnNSJmSMx_6U2OW_CcmKMG8vYtOB4FgGNpuxX6Rw%40mail.gmail.com > <https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8xGRpqnNSJmSMx_6U2OW_CcmKMG8vYtOB4FgGNpuxX6Rw%40mail.gmail.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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/tesseract-ocr. To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/CACxk%3DWwDYJGUWiYO4ufM7AQx9zu-FThbT-1twzSDAA6K_cLwTA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

