Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, February 14, 2011 2:47:50 AM(UTC)

jwevers  
jwevers

Groups: Registered
Posts: 10


I am porting a Delphi application tbhat currently uses GdPicture to Leadtools 17.

The GdPicture code calculates the probability of the recognition on a per-character basis. From this quote on your site:

http://www.leadtools.com/help/leadtools/v16/dh/to/leadtools.topics~leadtools.topics.ocrconfidencereporting.html

"In another approach, the Engine can generate output, which consists of
structured data for each recognized character. In this output there is
one structure or record for
each character. The character code of the recognized entity
is the primary field. Other fields include the coordinates of the
character on the image, the zone to which the
character belongs to, the font information for the character, and the confidence information."

However, I can't find how to access this information. None of the OCR examples I checked (mostlty those in C#) seem to use this. Anybody an idea how I store and access this data somewhere?
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, February 14, 2011 5:34:20 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

1. Are you using our DLL API or our .NET classes?
2. Which LEADTOOLS OCR engine are you using? Is it the Professional, Advantage or Plus?
3. Do you need to get a confidence value for each character, each word, or both?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Monday, February 14, 2011 5:53:02 AM(UTC)

jwevers  
jwevers

Groups: Registered
Posts: 10


I am using the C DLL version with the professional OCR engine. I need to get the confidence value for each character.

As I understand it from now, I need to parse a RECOGCHARS structure after calling L_DocRecognize() and L_DocGetRecognizedCharacters(), is this correct?

I have currently cpompile problems with array types:

  PtrRecogChars: pRECOGCHARS;
  lCharsCount: integer;

  nRet := L_DocRecognize(hDoc, @RecogOpts, nil, nil);
  nRet := L_DocGetRecognizedCharacters(hDoc, 0, @PtrRecogChars, @lCharsCount, sizeof(RECOGCHARS));

  for i:=1 to lCharsCount do
  begin
    topValue := PtrRecogChars[i].rcArea.Top;
  end;

this gives a compile error that PtrRecogChars is no array type.
 
#4 Posted : Tuesday, February 15, 2011 3:44:25 AM(UTC)

jwevers  
jwevers

Groups: Registered
Posts: 10


OK, got this working. One question left: how does the RECOGCHARS.nConfidence option count? From what I see in the results 0 means very sure the recognised character is correct., and it goes to 1000 (which probably means I have no idea what this character is)?
 
#5 Posted : Tuesday, February 15, 2011 12:46:14 PM(UTC)

Walter  
Walter

Groups: Tech Support
Posts: 366

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

Hello,

If you're using the OCR Professional engine, then you should be using all of the methods and structures that end with a number '2'. The structures and methods that end without this number are for the OCR Plus engine.

The documentation for the RECOGCHARS2 structure states the following:

"The application should evaluate the nConfidence member, when confidence information on the recognition is also required. Its most significant bit is used to express the certainty/uncertainty of the word (word is uncertain, if this bit set to one (1)). The remaining bits represent the certainty of the character recognition, which ranges between 0 and 100. The smaller this value is, the higher the confidence of the recognition. For more details, see the Confidence reporting topic."

The Confidence reporting topic for the OCR Professional engine can be found online here:
http://www.leadtools.com/Help/LEADTOOLS/v17/OCR/API/Dllsteps/ConfidencereportingOCRProfessional.htm

From this help file topic, it appears that this is the information that you are after:

"The RECOGCHARS2.nConfidence field is a combined value. Its most significant bit is used to express the certainty/uncertainty of the word. (If this bit is set to 1, the word is uncertain.) The remaining bits express the certainty of the character recognition: ranging from 0 to 100."

If you have any further questions or concerns regarding this, please let us know.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#6 Posted : Wednesday, February 16, 2011 1:30:48 AM(UTC)

jwevers  
jwevers

Groups: Registered
Posts: 10


Oops, my mistake, I use the Plus engine. But I think the following code does what I need: calculating the average probability for all scanned characters:

PtrRecogChars: array of RECOGCHARS;

// probability for this character, 100 = full trust, 0 = unrecognizable
charConfidence := 100 - (PtrRecogChars[i].nConfidence and $FFFFFFFE);

avgCharConfidence := avgCharConfidence + charConfidence;
Result := Result + Char(PtrRecogChars[i].wGuessCode);
avgCharConfidence := Round(avgCharConfidence / lCharsCount);
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.101 seconds.