Skip to content

get_text_resultGetTextResultGetTextResultget_text_resultT_get_text_resultπŸ”—

Short descriptionπŸ”—

get_text_resultGetTextResultGetTextResultget_text_resultT_get_text_result β€” Query a control value of a text segmentation result.

SignatureπŸ”—

get_text_result( text_result TextResultID, string ResultName, out string ResultValue )void GetTextResult( const HTuple& TextResultID, const HTuple& ResultName, HTuple* ResultValue )static void HOperatorSet.GetTextResult( HTuple textResultID, HTuple resultName, out HTuple resultValue )def get_text_result( text_result_id: HHandle, result_name: MaybeSequence[Union[str, int]] ) -> Sequence[Union[int, float, str]]

def get_text_result_s( text_result_id: HHandle, result_name: MaybeSequence[Union[str, int]] ) -> Union[int, float, str]Herror T_get_text_result( const Htuple TextResultID, const Htuple ResultName, Htuple* ResultValue )

HTuple HTextResult::GetTextResult( const HTuple& ResultName ) const

HTuple HTextResult::GetTextResult( const HString& ResultName ) const

HTuple HTextResult::GetTextResult( const char* ResultName ) const

HTuple HTextResult::GetTextResult( const wchar_t* ResultName ) const (Windows only)

HTuple HTextResult.GetTextResult( HTuple resultName )

HTuple HTextResult.GetTextResult( string resultName )

DescriptionπŸ”—

get_text_resultGetTextResult queries the control result ResultNameresultNameresult_name of TextResultIDtextResultIDtext_result_id returned by find_textFindText. The possible parameter values for ResultNameresultNameresult_name differ, depending on the text model used within the text segmentation process of find_textFindText.

In the following, first the possible parameter values for text models with Modemodemode = 'auto'"auto" are listed, and then those for text models with Modemodemode = 'manual'"manual".

The following results can be queried:

  • Results for text segmentation with text models with Mode = β€˜auto’

    For each polarity, the text lines are independently sorted from top to bottom and left to right. The character within the text lines are sorted from left to right.

    • 'num_lines'"num_lines": Number of lines found.

    • 'num_classes'"num_classes": Number of best classes stored for each character. Depending on the number of classes of the used classifier this value might be smaller than the one set in the text model, see set_text_model_paramSetTextModelParam.

    • 'class'"class": Classification results of all segmented characters with the OCR classifier contained in the corresponding text model. Note that if the classifier was trained with rejection class, get_text_resultGetTextResult returns the second best result for characters that are classified as rejection class.

    • '[class, n**'"[class, n**":] Similar to 'class'"class", except that the class with the (n+1)-highest confidence is returned. For example, ['class', 0]["class", 0] returns for each character the class with the highest confidence. Moreover, in contrast to 'class'"class", the rejection class can be returned if the classifier contained in the corresponding text model was trained with rejection class.

    • '[class_line, LineIndex**'"[class_line, LineIndex**":] Classification results of the characters within the text line specified by LineIndex with the OCR classifier contained in the corresponding text model. For example, ['class_line', 0]["class_line", 0] returns the character classes within the first text line. Note that if the classifier was trained with rejection class, get_text_resultGetTextResult returns the second best result for characters that are classified as rejection class.

    • '[class_line, LineIndex, n**'"[class_line, LineIndex, n**":] Similar to ['class_line', LineIndex]["class_line", LineIndex], except that the classes with the (n+1)-highest confidences are returned. For example, ['class_line', LineIndex, 0]["class_line", LineIndex, 0] returns for each character in the text line specified by LineIndex the class with the highest confidence. Moreover, in contrast to ['class_line', LineIndex]["class_line", LineIndex], the rejection class can be returned if the classifier contained in the corresponding text model was trained with rejection class.

    • '[class_element, Index**'"[class_element, Index**":] Classification result of the character at position Index with the OCR classifier contained in the corresponding text model. For example ['class_element', 0]["class_element", 0] returns the 'num_classes'"num_classes" best classes (sorted by confidence) of the first character.

    • 'confidence'"confidence": Returns the confidences of the classes for all segmented characters, see 'class'"class".

    • '[confidence, n**'"[confidence, n**":] Returns the confidences of the classes with the (n+1)-highest confidence, see ['class', n]["class", n].

    • '[confidence_line, LineIndex**'"[confidence_line, LineIndex**":] Returns the confidences of the classes of all characters within the text line specified by LineIndex, see ['class_line', LineIndex]["class_line", LineIndex].

    • '[confidence_line, LineIndex, n**'"[confidence_line, LineIndex, n**":] Returns the confidences of the classes with the (n+1)-highest confidence for all characters within the text line specified by LineIndex, see ['class_line', LineIndex, n]["class_line", LineIndex, n].

    • '[confidence_element, Index**'"[confidence_element, Index**":] Returns the confidences corresponding to the classes of the character at position Index, see ['class_element', Index]["class_element", Index].

    • 'polarity'"polarity": Returns the polarity of all segmented characters.

    • '[polarity_line, LineIndex**'"[polarity_line, LineIndex**":] Returns the polarity of the characters in the segmented text line specified by LineIndex. For example, ['polarity_line', 0]["polarity_line", 0] returns the polarity within the first text line.

    • '[polarity_element, Index**'"[polarity_element, Index**":] Returns the polarity of the character at the position Index. For example ['polarity_char', 0]["polarity_char", 0] returns the polarity of the first character.

  • Results for text segmentation with text models with Mode = β€˜manual’

    • 'manual_num_lines'"manual_num_lines": Number of lines found.

    If 'manual_persistence'"manual_persistence" was activated for the text model used to create TextResultIDtextResultIDtext_result_id, the following additional value can be queried:

    • 'manual_thresholds'"manual_thresholds": The thresholds used for segmentation.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

TextResultIDtextResultIDtext_result_id (input_control) text_result β†’ (handle)HTuple (HHandle)HTextResult, HTuple (IntPtr)HHandleHtuple (handle)

Text result.

ResultNameresultNameresult_name (input_control) string(-array) β†’ (string / integer)HTuple (HString / Hlong)HTuple (string / int / long)MaybeSequence[Union[str, int]]Htuple (char* / Hlong)

Name of the result to be returned.

Default: 'class'"class"
List of values: 'class', 'class_element', 'class_line', 'confidence', 'confidence_element', 'confidence_line', 'manual_num_lines', 'manual_thresholds', 'num_classes', 'num_lines', 'polarity', 'polarity_element', 'polarity_line'"class", "class_element", "class_line", "confidence", "confidence_element", "confidence_line", "manual_num_lines", "manual_thresholds", "num_classes", "num_lines", "polarity", "polarity_element", "polarity_line"

ResultValueresultValueresult_value (output_control) string(-array) β†’ (integer / real / string)HTuple (Hlong / double / HString)HTuple (int / long / double / string)Sequence[Union[int, float, str]]Htuple (Hlong / double / char*)

Value of ResultName.

ExampleπŸ”—

(HDevelop)

read_image (Image, 'numbers_scale')
create_text_model_reader ('auto', 'Document_Rej.omc', TextModel)
* Optionally specify text properties
set_text_model_param (TextModel, 'min_char_height', 20)
find_text (Image, TextModel, TextResultID)
* Return character regions and corresponding classification results
get_text_object (Characters, TextResultID, 'all_lines')
get_text_result (TextResultID, 'class', Class)

ResultπŸ”—

If the parameters are valid, the operator get_text_resultGetTextResult returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

find_textFindText

See also

get_text_objectGetTextObject

ModuleπŸ”—

Foundation