Tesseract confidence level sample code for java

580 views
Skip to first unread message

bala

unread,
Nov 19, 2014, 4:11:47 AM11/19/14
to tesser...@googlegroups.com
I would like to get the code for tesseract confidence level. Any sample code available ?

Allistair C

unread,
Nov 19, 2014, 9:06:44 AM11/19/14
to tesser...@googlegroups.com
baseApi.init(filesDir.getPath() + "/tesseract/", LANG);
baseApi.setPageSegMode(TessBaseAPI.PageSegMode.PSM_SINGLE_BLOCK);
baseApi.setImage(bmp);

OCRResult result = new OCRResult(baseApi.getUTF8Text(), baseApi.meanConfidence());

baseApi.end();

Note OCRResult is my own object for holding values.

Allistair C

unread,
Nov 19, 2014, 9:08:24 AM11/19/14
to tesser...@googlegroups.com
One thing I did find with meanConfidence is that it didn't really equate to reality. For instance a completely wrong OCR result can still be a high confidence result.


On Wednesday, 19 November 2014 09:11:47 UTC, bala wrote:

bala

unread,
Nov 27, 2014, 2:18:34 AM11/27/14
to tesser...@googlegroups.com
Thanks Allistair. I want to get the meanConfidence, so that I should be able to determine whether the OCR result is right or wrong. Is there a way ?

Quan Nguyen

unread,
Nov 28, 2014, 7:13:17 PM11/28/14
to tesser...@googlegroups.com
There are examples of getting the confidence at various levels (symbol, word, sentence, etc.) in the unit test cases of Tess4J.
Reply all
Reply to author
Forward
0 new messages