Can someone give a brief explanation on how to use the above script? Any 
help would be greatly appreciated.

On Saturday, June 2, 2012 1:32:44 AM UTC-7, hiran.suvrat wrote:
>
> Hi, 
>
> I went through lot of pages to find how to generate character level 
> confidence but with now success. I have also include 
> SetVariable("save_best_choices", "T") but it still des not work. Can 
> somebody please debug the code. Thanks a lot. 
>
> Code: 
> #include "allheaders.h" 
> #include "baseapi.h" 
> #include "strngs.h" 
> #include "tesseractmain.h" 
> #include "tprintf.h" 
>
> int main(int argc, char **argv) { 
>
>         const char *lang="eng"; 
>         const PIX   *pixs; 
>          if ((pixs = pixRead(argv[1])) == NULL) { 
>             printf("Unsupported image type.\n"); 
>             exit(3); 
>           } 
>         tesseract::TessBaseAPI  api; 
>         api.SetVariable("save_best_choices", "T"); 
>         api.SetImage(pixs); 
>         int rc = api.Init(argv[0], lang); 
>         api.Recognize(NULL); 
>
>         tesseract::ResultIterator* ri = api.GetIterator(); 
>         tesseract::ChoiceIterator* ci; 
>
>         if(ri != 0) 
>         { 
>             do 
>             { 
>                 const char* symbol = 
> ri->GetUTF8Text(tesseract::RIL_SYMBOL); 
>
> //                printf("======================"); 
>                 if(symbol != 0) 
>                 { 
>                     float conf = ri->Confidence(tesseract::RIL_SYMBOL); 
>                     printf("\nnext symbol: %s, conf: %f", symbol, conf, 
> "\n"); 
>
>                     const tesseract::ResultIterator itr = *ri; 
>                     ci = new tesseract::ChoiceIterator(itr); 
>                     do 
>                     { 
>                                 printf("----"); 
>                         const char* choice = ci->GetUTF8Text(); 
>                         printf("\t\t%s conf: %f", choice, 
> ci->Confidence()); 
>                     } 
>                     while(ci->Next()); 
>
>                     delete ci; 
>                 } 
>
>                 delete[] symbol; 
>                     }    while((ri->Next(tesseract::RIL_SYMBOL))); 
>         } 
>         return 0; 
> } 
>
>
> Output: 
>
> next symbol: c, conf: 85.844711----                (null) conf: 0.000000 
> next symbol: o, conf: 85.844711----                (null) conf: 0.000000 
> next symbol: m, conf: 85.844711----                (null) conf: 0.000000 
> next symbol: Q, conf: 0.000000----                (null) conf: 0.000000 
>
>
> Does anybody see a problem in it?? 
> Thanks in advance

-- 
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

Reply via email to