have a look at tesseract::ChoiceIterator. See https://github.com/tesseract-ocr/tesseract/wiki/APIExample#example-of-iterator-over-the-classifier-choices-for-a-single-symbol
Zdenko On Mon, Mar 14, 2016 at 6:17 AM, Sergio Mendoza <[email protected]> wrote: > So I've been trying to use tesseract ocr, (specifically tess-two) for an > android project to scan some symbols. > > Everything works fine but sometimes the recognized String is returned as > null. One of the solutions I found was to set the variable > save_blob_choices to true in order to have tesseract save alternatives > for recognition. > > > But I don't know if it indeed is supposed to do that. Where does it save > the alternatives? How do I access them? > > Of course if you have any other solution apart from using this variable, > please tell me. > > Here is my code: > > > TessBaseAPI baseApi = new TessBaseAPI(); > baseApi.setDebug(true); > baseApi.init(MainActivity.DATA_PATH, MainActivity.lang); > baseApi.setPageSegMode(TessBaseAPI.PageSegMode.PSM_SINGLE_CHAR); > > > baseApi.setVariable("tessedit_char_whitelist","abcdefghijklmnopqrst"); > baseApi.setVariable("save_blob_choices", "T"); > > baseApi.setImage(mainBitmap); > > publishProgress(80); > > > mainBitmap.recycle(); > mainBitmap = null; > // Iterate through the results.ResultIterator iterator = > baseApi.getResultIterator();String lastUTF8Text;float lastConfidence; > > > iterator.begin();do { > lastUTF8Text = > iterator.getUTF8Text(TessBaseAPI.PageIteratorLevel.RIL_SYMBOL); > lastConfidence = > iterator.confidence(TessBaseAPI.PageIteratorLevel.RIL_SYMBOL); > > Log.i("string, intConfidence",lastUTF8Text+", "+lastConfidence);} while > (iterator.next(TessBaseAPI.PageIteratorLevel.RIL_SYMBOL)); > > > baseApi.end(); > > > Also as an extra question, is base.setDebug(true) supposed to work? > Because it doesn't seem to do anything. > > -- > 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 https://groups.google.com/group/tesseract-ocr. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tesseract-ocr/1d742d69-6508-4e85-ba68-5e01fd7f9a36%40googlegroups.com > <https://groups.google.com/d/msgid/tesseract-ocr/1d742d69-6508-4e85-ba68-5e01fd7f9a36%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 https://groups.google.com/group/tesseract-ocr. To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8wJSaWXsjbbo_XU%2BFUQqZzgVwLRq2SrNc5AMuOq0xBfUA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

