I'm using Visual Studio 2012 on Win7. Version on tess is 3.02.02. I'm also 
using OpenCV (2.4.4) to some preprocess stuff, but I've cut it out to make 
source more clearly. 
Running from cmd as app gave same results - just needed to link proper path 
into datapath in Init(). 

*#include <opencv\cv.h>*
*#include <opencv2\imgproc\imgproc.hpp>*
*#include <opencv\highgui.h>*
*
*
*#include <tesseract\baseapi.h>*
*#include <leptonica\allheaders.h>*
*
*
*
*
*
*
*
*
*int main(int argc, char * argv[]){*
*
*
* IplImage* src = NULL;*
* if (!(src = cvLoadImage("krosno.jpg"))){*
* printf("%s %s","Could not load image file");*
* return 0;*
*
*
* }*
*
*
* tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();*
*
*
* if (api->Init("./", "pol", tesseract::OEM_DEFAULT))  {*
*      fprintf(stderr, "Could not initialize tesseract.\n");*
*      return 0;*
*    }*
*    *
* api->SetImage((unsigned char*)src->imageData, src->width,//iplImage -> 
imagedata*
*                   src->height, src->nChannels, src->widthStep);*
*
*
* char* outText = api->GetUTF8Text();*
* printf("OCR output:\n");*
* printf(outText);*
*
*
* cvReleaseImage( &src );*
*
*
*}*


I've seen some solutions on stackoverflow, but none of them works.

W dniu wtorek, 23 kwietnia 2013 21:58:45 UTC+2 użytkownik zdenop napisał:
>
> Show us whole code, give more details about about your compiler etc.. Also 
> run it from command line if there are any output (app should be created as 
> console app - just for testing))
>
> Zdenko
>
>
> On Tue, Apr 23, 2013 at 3:34 PM, Tom <[email protected] <javascript:>>wrote:
>
>> Hi,
>> I have used command line tesseract to check results of polish dictionary 
>> and it was k - almost everything was correctly recognized. 
>> But when i'm trying to do the same in some source - tesseract is working 
>> like only with eng dictionary (same results).
>> Initialization like this:
>>
>>
>> *tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();*
>> *if (api->Init("./", "pol", tesseract::OEM_DEFAULT))  {*
>> *      fprintf(stderr, "Could not initialize tesseract.\n");*
>> *      return 1;*
>> *}*
>> and then just 
>>
>> *char* outText = api->GetUTF8Text();*
>>
>> tessdata directory is with exe directory. 
>> I think there is a problem with opening pol.traineddata but i have no 
>> idea why and how to fix it.
>> I have also tried to set up TESSDATA_PREFIX to tessdata (both in 
>> Tesseract-OCR source and project source) but with no results.
>> Now it is just deleted - so datapath from Init is working.
>>
>> What am i doing wrong? 
>> How to use this dictionary?
>>
>> -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "tesseract-ocr" group.
>> To post to this group, send email to [email protected]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/tesseract-ocr?hl=en
>>  
>> --- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en

--- 
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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to