.net 3 Confidence is always 0

221 views
Skip to first unread message

Curtis

unread,
Mar 14, 2012, 2:49:20 PM3/14/12
to tesseract-ocr
I am using the vs 3 .net wrapper.
When I run the function Recognize it ocrs the image fine and I can get
the string.
I need the confidence level of each character, but it is always 0.
What am I doing wrong?



Dim image As New Bitmap("C:\MyImage.tif")
Dim ocr As New TesseractProcessor

ocr.Init(Nothing, "eng", False)
Console.WriteLine(ocr.Recognize(image))


ocr.InitForAnalysePage()
ocr.SetVariable("tessedit_thresholding_method", "1")
ocr.SetVariable("save_best_choices", "T")


Dim doc As DocumentLayout = ocr.AnalyseLayout(image)
For Each blk As OCR.TesseractWrapper.Block In doc.Blocks
Console.WriteLine("Block Confidence: " & blk.Confidence)


For Each para As Paragraph In blk.Paragraphs
Console.WriteLine("para Confidence: " &
para.Confidence)

For Each ln As TextLine In para.Lines
Console.WriteLine("ln Confidence: " &
ln.Confidence)

For Each wrd As Word In ln.Words
Console.WriteLine("wrd Confidence: " &
wrd.Confidence)
Console.WriteLine("wrd Text: " & wrd.Text)

For Each ch As Character In wrd.CharList
Console.WriteLine("V:" & ch.Value)
Console.WriteLine("C:" & ch.Confidence)
Next

Next

Next
Next
Next

Sriranga(78yrs)

unread,
Mar 14, 2012, 11:33:45 PM3/14/12
to tesser...@googlegroups.com
For tesseract wrappers issues - pl see  http://code.google.com/p/tesseract-ocr/wiki/AddOns page.


--
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to tesser...@googlegroups.com
To unsubscribe from this group, send email to
tesseract-oc...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en

Zdenko Podobný

unread,
Mar 16, 2012, 4:18:21 PM3/16/12
to tesser...@googlegroups.com
Hi,

I am not familiar with .net so I can not help you directly.

It looks like that .net wrapper was not updated for quite a long time
(revision 590 without 3.01 code)...
Anyway if somebody interesting in char confidence he can try to use (in
c++) GetComponentImages&tesseract::RIL_SYMBOL +
PageSegMode&tesseract::PSM_SINGLE_CHAR. Simple test file attached.
Tested in 3.02 (in svn) code.

Zdenko

test_confidence.cpp
Reply all
Reply to author
Forward
0 new messages