ClassesClasses | | Operators

find_textT_find_textFindTextFindText (Operator)

Name

find_textT_find_textFindTextFindText — Find text in an image.

Signature

find_text(Image : : TextModel : TextResultID)

Herror T_find_text(const Hobject Image, const Htuple TextModel, Htuple* TextResultID)

void FindText(const HObject& Image, const HTuple& TextModel, HTuple* TextResultID)

HTextResult HImage::FindText(const HTextModel& TextModel) const

HTextResult HTextModel::FindText(const HImage& Image) const

void HTextResult::HTextResult(const HImage& Image, const HTextModel& TextModel)

void HTextResult::FindText(const HImage& Image, const HTextModel& TextModel)

static void HOperatorSet.FindText(HObject image, HTuple textModel, out HTuple textResultID)

HTextResult HImage.FindText(HTextModel textModel)

HTextResult HTextModel.FindText(HImage image)

public HTextResult(HImage image, HTextModel textModel)

void HTextResult.FindText(HImage image, HTextModel textModel)

Description

find_textfind_textFindTextFindTextFindText finds text specified by the TextModelTextModelTextModelTextModeltextModel in the ImageImageImageImageimage and returns the result in TextResultIDTextResultIDTextResultIDTextResultIDtextResultID. Specific results of TextResultIDTextResultIDTextResultIDTextResultIDtextResultID can be obtained with get_text_resultget_text_resultGetTextResultGetTextResultGetTextResult and get_text_objectget_text_objectGetTextObjectGetTextObjectGetTextObject.

The text results in TextResultIDTextResultIDTextResultIDTextResultIDtextResultID differ, depending on how ModeModeModeModemode was set when creating the TextModelTextModelTextModelTextModeltextModel with create_text_model_readercreate_text_model_readerCreateTextModelReaderCreateTextModelReaderCreateTextModelReader.

For a text model with ModeModeModeModemode = 'auto'"auto""auto""auto""auto" find_textfind_textFindTextFindTextFindText extracts and classifies text of arbitrary size within the ImageImageImageImageimage. It is possible to restrict the search to characters with specific attributes, see set_text_model_paramset_text_model_paramSetTextModelParamSetTextModelParamSetTextModelParam for details.

For a text model with ModeModeModeModemode = 'manual'"manual""manual""manual""manual" reasonable parameters for the text model, including the expected character height and width, need to be set using set_text_model_paramset_text_model_paramSetTextModelParamSetTextModelParamSetTextModelParam. Furthermore, the ImageImageImageImageimage is preprocessed such that character like structures are enhanced. The resulting compensated image can be queried from TextResultIDTextResultIDTextResultIDTextResultIDtextResultID if 'persistence'"persistence""persistence""persistence""persistence" was set to 'true' in TextModelTextModelTextModelTextModeltextModel.

Both the text models with ModeModeModeModemode = 'auto'"auto""auto""auto""auto" and ModeModeModeModemode = 'manual'"manual""manual""manual""manual" apply various thresholds to the input image and segment character candidates based on region and gray value features. These candidates are further clustered to lines. Each line is individually completed and tested if it fulfills the constraints of a text line. Text models with ModeModeModeModemode set to 'auto'"auto""auto""auto""auto" require a text line to consist of at least two characters, whereas text models with ModeModeModeModemode set to 'manual'"manual""manual""manual""manual" require a text line to consist of at least three characters. In a further step, punctuations and separators are added if the correspondent parameters were set via set_text_model_paramset_text_model_paramSetTextModelParamSetTextModelParamSetTextModelParam. Finally, if TextModelTextModelTextModelTextModeltextModel contains 'text_line_structure'"text_line_structure""text_line_structure""text_line_structure""text_line_structure" entries, the completed line is fitted to these structures.

find_textfind_textFindTextFindTextFindText finds text which is roughly horizontally aligned in ImageImageImageImageimage. text_line_orientationtext_line_orientationTextLineOrientationTextLineOrientationTextLineOrientation and rotate_imagerotate_imageRotateImageRotateImageRotateImage can be used to achieve this alignment.

Since memory is allocated for the text result during the call of find_textfind_textFindTextFindTextFindText and during the following operations, the text result should be freed explicitly by the operator clear_text_resultclear_text_resultClearTextResultClearTextResultClearTextResult as soon as it is no longer used.

Execution Information

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

This operator supports cancelling timeouts.

Parameters

ImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHobject (byte / uint2)

Input image.

TextModelTextModelTextModelTextModeltextModel (input_control)  text_model HTextModel, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Text model specifying the text to be segmented.

TextResultIDTextResultIDTextResultIDTextResultIDtextResultID (output_control)  text_result HTextResult, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Result of the segmentation.

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 find_textfind_textFindTextFindTextFindText returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Possible Predecessors

create_text_model_readercreate_text_model_readerCreateTextModelReaderCreateTextModelReaderCreateTextModelReader, set_text_model_paramset_text_model_paramSetTextModelParamSetTextModelParamSetTextModelParam, text_line_orientationtext_line_orientationTextLineOrientationTextLineOrientationTextLineOrientation, text_line_slanttext_line_slantTextLineSlantTextLineSlantTextLineSlant

Possible Successors

get_text_resultget_text_resultGetTextResultGetTextResultGetTextResult, get_text_objectget_text_objectGetTextObjectGetTextObjectGetTextObject

Module

OCR/OCV


ClassesClasses | | Operators