have a look at issue 714[1]. Reporter proposed also fix (you will need to change tessseract code)
[1] http://code.google.com/p/tesseract-ocr/issues/detail?id=714<http://code.google.com/p/tesseract-ocr/issues/detail?id=714#c1> -- Zdenko On Sat, Jun 2, 2012 at 10:32 AM, hiran.suvrat <[email protected]>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 > -- 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

