Is there a way to iterate over the classifier choices in tesseract 4

20 views
Skip to first unread message

Sebastian Correa

unread,
Sep 27, 2018, 7:15:40 AM9/27/18
to tesseract-ocr
I am working in a project with tesseract 3 and I want to migrate to Tesseract 4. When I iterate I dont get the multiple choices like in tesseract 3.

Tesseract 3:

Symbol: O, Conf: 91.2741
O conf: 91.2741
C conf: 82.6332
G conf: 80.8132
Q conf: 80.6637
D conf: 80.5849

Tesseract 4:

Symbol: O, Conf: 99.5507
O conf: 99.5507

This is my code:


tesseract::PageIteratorLevel level = RIL_SYMBOL;
if(ri != 0) {
do {
const char* symbol = ri->GetUTF8Text(level);
float conf = ri->Confidence(level);
if(symbol != 0) {
cerr << "Symbol: " << symbol << ", Conf: " << conf << endl;
tesseract::ChoiceIterator ci(*ri);
do {
const char* choice = ci.GetUTF8Text();
cerr << choice << " conf: " << ci.Confidence() << endl;
} while(ci.Next());
}
cerr << "---------------------------------------------\n" << endl;
delete[] symbol;
} while((ri->Next(level)));
}
Reply all
Reply to author
Forward
0 new messages