Removing low confidence characters in FRE12.

Question

How to remove low-level confidence characters in FineReader Engine 12?

Answer

You can remove low-level confidence characters from a paragraph with the following code, assuming a paragraph is a CSafePtr<IParagraph> object and the level is an int variable, which is the minimum level of confidence for characters.

//CSafePtr<IParagraph> paragraph = ...
//int level = ...
int shift = 0;
CBstr text;
CheckResult(paragraph->get_Text(text.GetBuffer()));
CSafePtr<ICharParams> charParams;
CSafePtr<ICharacterRecognitionVariant> charRecVar = 0;
int charLevel = 0;
CheckResult(Engine->CreateCharParams(&charParams));

for (int index = 0; index < text.Length(); index++)
{
CheckResult(paragraph->GetCharParams(index - shift, charParams));
CheckResult(charParams->get_SelectedCharacterRecognitionVariant(&charRecVar));
if (charRecVar) //The property contains zero for non-printable characters (spaces, carriage returns, etc.).
{
CheckResult(charRecVar->get_CharConfidence(&charLevel));
if (charLevel < level)
{
CheckResult(paragraph->Remove(index - shift));
k++;
}
}
}

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.