Operator Reference

get_text_resultT_get_text_resultGetTextResultGetTextResultget_text_result (Operator)

get_text_resultT_get_text_resultGetTextResultGetTextResultget_text_result — Query a control value of a text segmentation result.

Signature

get_text_result( : : TextResultID, ResultName : ResultValue)

Herror T_get_text_result(const Htuple TextResultID, const Htuple ResultName, Htuple* ResultValue)

void GetTextResult(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)

static void HOperatorSet.GetTextResult(HTuple textResultID, HTuple resultName, out HTuple resultValue)

HTuple HTextResult.GetTextResult(HTuple resultName)

HTuple HTextResult.GetTextResult(string resultName)

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]

Description

get_text_resultget_text_resultGetTextResultGetTextResultget_text_result queries the control result ResultNameResultNameResultNameresultNameresult_name of TextResultIDTextResultIDTextResultIDtextResultIDtext_result_id returned by find_textfind_textFindTextFindTextfind_text. The possible parameter values for ResultNameResultNameResultNameresultNameresult_name differ, depending on the text model used within the text segmentation process of find_textfind_textFindTextFindTextfind_text.

In the following, first the possible parameter values for text models with ModeModeModemodemode = 'auto'"auto""auto""auto""auto" are listed, and then those for text models with ModeModeModemodemode = 'manual'"manual""manual""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""num_lines""num_lines""num_lines":

    Number of lines found.

    'num_classes'"num_classes""num_classes""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_paramset_text_model_paramSetTextModelParamSetTextModelParamset_text_model_param.

    'class'"class""class""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_resultget_text_resultGetTextResultGetTextResultget_text_result returns the second best result for characters that are classified as rejection class.

    ['class', n]["class", n]["class", n]["class", n]["class", n]:

    Similar to 'class'"class""class""class""class", except that the class with the (n+1)-highest confidence is returned. For example, ['class', 0]["class", 0]["class", 0]["class", 0]["class", 0] returns for each character the class with the highest confidence. Moreover, in contrast to 'class'"class""class""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]["class_line", LineIndex]["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]["class_line", 0]["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_resultget_text_resultGetTextResultGetTextResultget_text_result returns the second best result for characters that are classified as rejection class.

    ['class_line', LineIndex, n]["class_line", LineIndex, n]["class_line", LineIndex, n]["class_line", LineIndex, n]["class_line", LineIndex, n]:

    Similar to ['class_line', LineIndex]["class_line", LineIndex]["class_line", LineIndex]["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]["class_line", LineIndex, 0]["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]["class_line", LineIndex]["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]["class_element", Index]["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]["class_element", 0]["class_element", 0]["class_element", 0] returns the 'num_classes'"num_classes""num_classes""num_classes""num_classes" best classes (sorted by confidence) of the first character.

    'confidence'"confidence""confidence""confidence""confidence":

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

    ['confidence', n]["confidence", n]["confidence", n]["confidence", n]["confidence", n]:

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

    ['confidence_line', LineIndex]["confidence_line", LineIndex]["confidence_line", LineIndex]["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]["class_line", LineIndex]["class_line", LineIndex]["class_line", LineIndex].

    ['confidence_line', LineIndex, n]["confidence_line", LineIndex, n]["confidence_line", LineIndex, n]["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]["class_line", LineIndex, n]["class_line", LineIndex, n]["class_line", LineIndex, n].

    ['confidence_element', Index]["confidence_element", Index]["confidence_element", Index]["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]["class_element", Index]["class_element", Index]["class_element", Index].

    'polarity'"polarity""polarity""polarity""polarity":

    Returns the polarity of all segmented characters.

    ['polarity_line', LineIndex]["polarity_line", LineIndex]["polarity_line", LineIndex]["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]["polarity_line", 0]["polarity_line", 0]["polarity_line", 0] returns the polarity within the first text line.

    ['polarity_element', Index]["polarity_element", Index]["polarity_element", Index]["polarity_element", Index]["polarity_element", Index]:

    Returns the polarity of the character at the position Index. For example ['polarity_char', 0]["polarity_char", 0]["polarity_char", 0]["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""manual_num_lines""manual_num_lines""manual_num_lines":

    Number of lines found.

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

    'manual_thresholds'"manual_thresholds""manual_thresholds""manual_thresholds""manual_thresholds":

    The thresholds used for segmentation.

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

TextResultIDTextResultIDTextResultIDtextResultIDtext_result_id (input_control)  text_result HTextResult, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Text result.

ResultNameResultNameResultNameresultNameresult_name (input_control)  string(-array) HTupleMaybeSequence[Union[str, int]]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Name of the result to be returned.

Default: 'class' "class" "class" "class" "class"

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

ResultValueResultValueResultValueresultValueresult_value (output_control)  string(-array) HTupleSequence[Union[int, float, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (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_resultget_text_resultGetTextResultGetTextResultget_text_result returns the value 2 ( H_MSG_TRUE) . If necessary, an exception is raised.

Possible Predecessors

find_textfind_textFindTextFindTextfind_text

See also

get_text_objectget_text_objectGetTextObjectGetTextObjectget_text_object

Module

Foundation