find_textT_find_textFindTextFindTextfind_text (算子)

名称

find_textT_find_textFindTextFindTextfind_text — 在图像中查找文本。

签名

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)

def find_text(image: HObject, text_model: HHandle) -> HHandle

描述

find_textfind_textFindTextFindTextFindTextfind_text finds text specified by the TextModelTextModelTextModelTextModeltextModeltext_model in the ImageImageImageImageimageimage and returns the result in TextResultIDTextResultIDTextResultIDTextResultIDtextResultIDtext_result_id. Specific results of TextResultIDTextResultIDTextResultIDTextResultIDtextResultIDtext_result_id can be obtained with get_text_resultget_text_resultGetTextResultGetTextResultGetTextResultget_text_result and get_text_objectget_text_objectGetTextObjectGetTextObjectGetTextObjectget_text_object

The text results in TextResultIDTextResultIDTextResultIDTextResultIDtextResultIDtext_result_id differ, depending on how ModeModeModeModemodemode was set when creating the TextModelTextModelTextModelTextModeltextModeltext_model with create_text_model_readercreate_text_model_readerCreateTextModelReaderCreateTextModelReaderCreateTextModelReadercreate_text_model_reader

For a text model with ModeModeModeModemodemode = 'auto'"auto""auto""auto""auto""auto" find_textfind_textFindTextFindTextFindTextfind_text extracts and classifies text of arbitrary size within the ImageImageImageImageimageimage. It is possible to restrict the search to characters with specific attributes, see set_text_model_paramset_text_model_paramSetTextModelParamSetTextModelParamSetTextModelParamset_text_model_param for details.

For a text model with ModeModeModeModemodemode = 'manual'"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_paramSetTextModelParamSetTextModelParamSetTextModelParamset_text_model_param。Furthermore, the ImageImageImageImageimageimage is preprocessed such that character like structures are enhanced. The resulting compensated image can be queried from TextResultIDTextResultIDTextResultIDTextResultIDtextResultIDtext_result_id if 'persistence'"persistence""persistence""persistence""persistence""persistence" was set to 'true'"true""true""true""true""true" in TextModelTextModelTextModelTextModeltextModeltext_model

Both the text models with ModeModeModeModemodemode = 'auto'"auto""auto""auto""auto""auto" and ModeModeModeModemodemode = 'manual'"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 ModeModeModeModemodemode set to 'auto'"auto""auto""auto""auto""auto" require a text line to consist of at least two characters, whereas text models with ModeModeModeModemodemode set to 'manual'"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_paramSetTextModelParamSetTextModelParamSetTextModelParamset_text_model_param。Finally, if TextModelTextModelTextModelTextModeltextModeltext_model contains 'text_line_structure'"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_textFindTextFindTextFindTextfind_text finds text which is roughly horizontally aligned in ImageImageImageImageimageimage. text_line_orientationtext_line_orientationTextLineOrientationTextLineOrientationTextLineOrientationtext_line_orientation and rotate_imagerotate_imageRotateImageRotateImageRotateImagerotate_image can be used to achieve this alignment.

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

执行信息

此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。

此算子支持取消超时和中断。

参数

ImageImageImageImageimageimage (输入对象)  singlechannelimage objectHImageHObjectHImageHobject (byte / uint2)

输入图像。

TextModelTextModelTextModelTextModeltextModeltext_model (输入控制)  text_model HTextModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Text model specifying the text to be segmented.

TextResultIDTextResultIDTextResultIDTextResultIDtextResultIDtext_result_id (输出控制)  text_result HTextResult, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Result of the segmentation.

示例(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)

结果

如果参数有效,算子 find_textfind_textFindTextFindTextFindTextfind_text 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。

可能的前趋

create_text_model_readercreate_text_model_readerCreateTextModelReaderCreateTextModelReaderCreateTextModelReadercreate_text_model_reader, set_text_model_paramset_text_model_paramSetTextModelParamSetTextModelParamSetTextModelParamset_text_model_param, text_line_orientationtext_line_orientationTextLineOrientationTextLineOrientationTextLineOrientationtext_line_orientation, text_line_slanttext_line_slantTextLineSlantTextLineSlantTextLineSlanttext_line_slant

可能的后继

get_text_resultget_text_resultGetTextResultGetTextResultGetTextResultget_text_result, get_text_objectget_text_objectGetTextObjectGetTextObjectGetTextObjectget_text_object

模块

光学字符识别/光学字符验证