CharParams Object (ICharParams Interface)
This object allows you to access different parameters of a single character in recognized text: its formatting, rectangle on the image, recognition language, and hypotheses of recognition. All the Boolean properties of a newly created object of this type are set to FALSE.
Important! If you wish to work with the parameters of a certain character in the recognized text, you must first call any of the functions that perform synthesis (e.g., the Process or Synthesize method of the FRDocument object), as these parameters become meaningful only after synthesis.
If the character is obtained from the text of a business card, only the following properties of the object are set:
- BaseLine
- Bottom
- Left
- Right
- Top
- IsSuspicious
- CharacterRegion
- CharacterRecognitionVariantIndex
- CharacterRecognitionVariants
- SelectedCharacterRecognitionVariant
- WordRecognitionVariants
- IsFromSourceContent
- IsWordFirst
- IsWordLeftmost
Properties
Name | Type | Description |
---|---|---|
Application | Engine, read-only | Returns the Engine object. |
Character recognition language | ||
LanguageId | LanguageIdEnum |
Specifies the ID of the language of the character. To convert it to Win32 LCID use the IEngine::ConvertLanguageIdToLCID method. By default, this property is initialized with the system default language ID. |
LanguageName | BSTR |
Stores and allows you to set internal name of the language for a character. Note: If one base recognition language corresponds to one recognized word, the LanguageName property for each character in this word is set to the internal name of the base language after recognition. If several base recognition languages correspond to one word (e.g., for bilingual compound words), the LanguageName property for the characters in this word is empty. While the LanguageId property contains the identifier of the base language no matter what the recognized word is. By default, the value of this property is an empty string. |
Character coordinates | ||
CharacterRegion | Region |
Specifies the character exact region. The region may not be rectangular and initially is contained in the rectangle defined by the Left, Top, Right, and Bottom properties. If you change the character exact region, the Left, Top, Right, and Bottom properties are not changed. The property is only available after recognition with the IRecognizerParams::SaveCharacterRegions property set to TRUE. Note: The property returns a constant object. To change the character exact region, you must at first obtain an intermediate Region object using the IEngine::CreateRegion method, change the necessary parameters, and then assign the obtained object to the property. |
Bottom | int, read-only |
Stores the coordinate of the bottom border of the character rectangle. This rectangle is defined on image, not accounting for the text orientation. It may be undefined, in which case all four coordinates are zeros. This property cannot be changed directly but through the SetRect method. The default value of this property is 0. |
Left | int, read-only |
Stores the coordinate of the left border of the character rectangle. This rectangle is defined on image, not accounting for the text orientation. It may be undefined, in which case all four of its coordinates are zeros. This property cannot be changed directly but through the SetRect method. The default value of this property is 0. |
Right | int, read-only |
Stores the coordinate of the right border of the character rectangle. This rectangle is defined on image, not accounting for the text orientation. It may be undefined, in which case all four of its coordinate are zeros. This property cannot be changed directly but through the SetRect method. The default value of this property is 0. |
Top | int, read-only |
Stores the coordinate of the top border of the character rectangle. This rectangle is defined on image, not accounting for the text orientation. It may be undefined, in which case all four of its coordinate are zeros. This property cannot be changed directly but through the SetRect method. The default value of this property is 0. |
Character position, scaling and spacing | ||
IsWordLeftmost | VARIANT_BOOL |
Specifies whether the character is the leftmost character in a word. In complicated situations (such as two words not separated by a space or one word containing a punctuation mark without the spaces) this property may not work correctly. The recognizer may change the hypothesis about the number of words after the flags for characters were set. This property is set during synthesis. If the property is called before the synthesis is completed it is FALSE by default. Note: For Chinese, Japanese, or Korean this property is unreliable, as the words are not detected. |
IsWordFirst | VARIANT_BOOL |
Specifies whether the character is the first character in a word. This property is set during synthesis. If the property is called before the synthesis is completed it is FALSE by default. Notes:
|
BaseLine | int |
Sets the shift of a character from the base line of the string in pixels. The base line of the string is defined by the IParagraphLine::BaseLine property. This property is mainly used for the pictures embedded in text. By default, the value of this property is 0. |
Spacing | int |
Specifies additional spacing between characters in twips. Twip is 1/20 of point, and point is 1/72". Default value of this property is 0. |
HorizontalScale | int |
Stores horizontal scaling for a character in 1/1000. If the character is obtained from the text of a business card, this property has default value. Default for this property is 1000, which corresponds to no scaling. |
Character decoration | ||
Color | int |
Sets the RGB value of the color for the symbol. Its background color is defined for the whole paragraph by the IParagraphParams::BackgroundColor property. The value of this property can be -1, which means that the color is transparent.
Note: The int value is calculated from the RGB triplet using the formula: (red value) + (256 x green value) + (65536 x blue value), where red value is the first triplet component, green value is the second triplet component, blue value is the third triplet component. For example, the int value of the color white equals 16777215. By default, the text color is black or RGB(0,0,0). |
IsBold | VARIANT_BOOL |
Specifies whether the character is bold. If the character is obtained from the text of a business card, this property has default value. This property is FALSE by default. |
IsItalic | VARIANT_BOOL |
Specifies whether the character is italic. If the character is obtained from the text of a business card, this property has default value. This property is FALSE by default. |
IsUnderlined | VARIANT_BOOL |
Specifies whether the character is underlined. This property is FALSE by default. |
IsStrikeout | VARIANT_BOOL |
Specifies whether the character is strikeout. If the character is obtained from the text of a business card, this property has default value. This property is FALSE by default. |
IsSubscript | VARIANT_BOOL |
Specifies whether the character is subscript. It cannot be set to TRUE simultaneously with the IsSuperscript property, as this will lead to errors during recognized text export. If the character is obtained from the text of a business card, this property has default value. This property is FALSE by default. |
IsSuperscript | VARIANT_BOOL |
Specifies whether the character is superscript. It cannot be set to TRUE simultaneously with the IsSubscript property, as this will lead to errors during recognized text export. If the character is obtained from the text of a business card, this property has default value. This property is FALSE by default. |
IsSmallCaps | VARIANT_BOOL |
Specifies whether the character has "small caps" style. This means that the small characters are displayed as small capitals. This property is FALSE by default. |
Font attributes | ||
FontName | BSTR, read-only |
Stores the name of the font for a character. This property cannot be changed directly but via the SetFont method. By default, this value is "Times New Roman". |
FontSize | int |
Specifies the height of the font of the character in twips. Twip is 1/20 of point, and point is 1/72". Default value of this property corresponds to 10 points or 200 twips. |
FontStyle | FontStyle | Provides access to the font style of the character. |
FontType | FontTypeEnum, read-only |
Stores the type of the font for a character. This property cannot be changed directly but via the SetFont method. By default, this value is FT_Unknown. |
Character confidence and recognition variants | ||
IsSuspicious | VARIANT_BOOL |
This property set to TRUE means that the character was recognized unreliably. Detailed information about recognition confidence for each recognition variant can be obtained from the CharacterRecognitionVariant object. In ABBYY FineReader suspicious characters are highlighted with background color in the recognized text. See also What is the difference between the CharConfidence and the IsSuspicious properties? This property is FALSE by default. |
CharacterRecognitionVariants | CharacterRecognitionVariants, read-only |
Returns a collection of variants of character recognition. The property contains zero for non-printable characters (spaces, carriage returns, etc.) and characters that were not recognized but added to the text during explicit editing. Zero is also returned if the text was recognized by one of the previous ABBYY FineReader Engine versions. If the IRecognizerParams::SaveCharacterRecognitionVariants property is set to FALSE the return collection contains one element; otherwise, the collection contains no less than one element and the variants are ordered from the best to the worst. |
CharacterRecognitionVariantIndex | int, read-only | Stores the index of the selected variant of character recognition in the CharacterRecognitionVariants collection. |
SelectedCharacterRecognitionVariant | CharacterRecognitionVariant, read-only | Stores the selected variant of character recognition. It is the element with the index CharacterRecognitionVariantIndex in the collection of character recognition variants (the CharacterRecognitionVariants property). |
WordRecognitionVariants | WordRecognitionVariants, read-only |
Returns a collection of recognition variants for the word to which the character belongs. The property contains zero for non-printable characters (spaces, carriage returns, etc.) and characters that were not recognized but added to the text during explicit editing. Zero is also returned if the text was recognized by one of the previous ABBYY FineReader Engine versions. If the IRecognizerParams::SaveWordRecognitionVariants property is set to FALSE the return collection contains one element; otherwise, the collection contains no less than one element and the variants are ordered from the best to the worst, determined by the internal estimation mechanism. |
IsFromSourceContent | VARIANT_BOOL, read-only | Specifies whether the character has been extracted from the text content of the input file without recognition. For example, it can be extracted from a PDF file with a text layer. |
IsProofed | VARIANT_BOOL | Specifies whether a spell-checking was performed upon this character. It is not used or set internally by ABBYY FineReader Engine and just provides you a framework for spelling. |
Methods
Name | Description |
---|---|
CopyFrom | Initializes properties of the current object with the values of similar properties of another object. |
SetFont | Sets the new font for the symbol. |
SetRect | Sets the new rectangle for the symbol. |
Related objects
Output parameter
This object is the output parameter of the following methods:
- CreateCharParams method of the Engine object
- GetDropCapCharParams method of the Paragraph object
- GetCharParams method of the BusinessCardField object
- GetCharParams method of the BusinessCardFieldComponent object
- GetCharParams method of the MrzField object
Input parameter
This object is passed as an input parameter to the following methods:
- GetCharParams, SetCharParams, Insert, InsertParagraphBreak method of the Paragraph object
- GetCharParams method of the WordRecognitionVariant object
- Insert method of the MrzField object
Samples
C# code
The object is used in the following code samples: RecognizedTextProcessing; and demo tools: Camera OCR, Engine Predefined Processing Profiles, Image Preprocessing.
See also
17.09.2024 15:14:41