ClassesClassesClassesClasses | | | | Operators

create_text_model_readercreate_text_model_readerCreateTextModelReadercreate_text_model_readerCreateTextModelReaderCreateTextModelReader (Operator)

Name

create_text_model_readercreate_text_model_readerCreateTextModelReadercreate_text_model_readerCreateTextModelReaderCreateTextModelReader — Create a text model.

Signature

create_text_model_reader( : : Mode, OCRClassifier : TextModel)

Herror create_text_model_reader(const char* Mode, const char* OCRClassifier, Hlong* TextModel)

Herror T_create_text_model_reader(const Htuple Mode, const Htuple OCRClassifier, Htuple* TextModel)

Herror create_text_model_reader(const HTuple& Mode, const HTuple& OCRClassifier, Hlong* TextModel)

void HTextModel::CreateTextModelReader(const HTuple& Mode, const HTuple& OCRClassifier)

void CreateTextModelReader(const HTuple& Mode, const HTuple& OCRClassifier, HTuple* TextModel)

void HTextModel::HTextModel(const HString& Mode, const HTuple& OCRClassifier)

void HTextModel::HTextModel(const HString& Mode, const HString& OCRClassifier)

void HTextModel::HTextModel(const char* Mode, const char* OCRClassifier)

void HTextModel::CreateTextModelReader(const HString& Mode, const HTuple& OCRClassifier)

void HTextModel::CreateTextModelReader(const HString& Mode, const HString& OCRClassifier)

void HTextModel::CreateTextModelReader(const char* Mode, const char* OCRClassifier)

void HOperatorSetX.CreateTextModelReader(
[in] VARIANT Mode, [in] VARIANT OCRClassifier, [out] VARIANT* TextModel)

void HTextModelX.CreateTextModelReader(
[in] BSTR Mode, [in] VARIANT OCRClassifier)

static void HOperatorSet.CreateTextModelReader(HTuple mode, HTuple OCRClassifier, out HTuple textModel)

public HTextModel(string mode, HTuple OCRClassifier)

public HTextModel(string mode, string OCRClassifier)

void HTextModel.CreateTextModelReader(string mode, HTuple OCRClassifier)

void HTextModel.CreateTextModelReader(string mode, string OCRClassifier)

Description

create_text_model_readercreate_text_model_readerCreateTextModelReadercreate_text_model_readerCreateTextModelReaderCreateTextModelReader creates a TextModelTextModelTextModelTextModelTextModeltextModel, which describes the text to be segmented with find_textfind_textFindTextfind_textFindTextFindText.

The parameter value of ModeModeModeModeModemode determines which text segmentation approach is used. Possible values are 'auto'"auto""auto""auto""auto""auto" and 'manual'"manual""manual""manual""manual""manual".

Typically, the parameter ModeModeModeModeModemode should be set to 'auto'"auto""auto""auto""auto""auto" because this mode is more stable and requires less configuration effort. Note that in this case, also an OCR classifier must be passed in OCRClassifierOCRClassifierOCRClassifierOCRClassifierOCRClassifierOCRClassifier. Only if one of the following restrictions apply, ModeModeModeModeModemode must be set to 'manual'"manual""manual""manual""manual""manual":

If ModeModeModeModeModemode = 'auto'"auto""auto""auto""auto""auto", find_textfind_textFindTextfind_textFindTextFindText is able to extract text of arbitrary size. It is possible to restrict the search to characters with specific attributes, see set_text_model_paramset_text_model_paramSetTextModelParamset_text_model_paramSetTextModelParamSetTextModelParam for details. Particulary, if the text to be segmented contains dot printed characters, the text model parameter 'dot_print'"dot_print""dot_print""dot_print""dot_print""dot_print" must be set to 'true'"true""true""true""true""true". Furthermore, an OCR classifier must be passed in OCRClassifierOCRClassifierOCRClassifierOCRClassifierOCRClassifierOCRClassifier. This OCR classifier must be based on a convolutional neural network (CNN) or a multilayer perceptron (MLP). Moreover, it is strongly recommended to use a CNN based OCR classifier with rejection class or a MLP based classifiers that has been trained with regularization parameters (see set_regularization_params_ocr_class_mlpset_regularization_params_ocr_class_mlpSetRegularizationParamsOcrClassMlpset_regularization_params_ocr_class_mlpSetRegularizationParamsOcrClassMlpSetRegularizationParamsOcrClassMlp and provides a rejection class (see set_rejection_params_ocr_class_mlpset_rejection_params_ocr_class_mlpSetRejectionParamsOcrClassMlpset_rejection_params_ocr_class_mlpSetRejectionParamsOcrClassMlpSetRejectionParamsOcrClassMlp). A suitable OCR classifier can either be read with read_ocr_class_cnnread_ocr_class_cnnReadOcrClassCnnread_ocr_class_cnnReadOcrClassCnnReadOcrClassCnn or read_ocr_class_mlpread_ocr_class_mlpReadOcrClassMlpread_ocr_class_mlpReadOcrClassMlpReadOcrClassMlp, or be created with create_ocr_class_mlpcreate_ocr_class_mlpCreateOcrClassMlpcreate_ocr_class_mlpCreateOcrClassMlpCreateOcrClassMlp. It is also possible to pass a string containing the path to a pretrained OCR classifier or an OCR classifier that has been stored with write_ocr_class_mlpwrite_ocr_class_mlpWriteOcrClassMlpwrite_ocr_class_mlpWriteOcrClassMlpWriteOcrClassMlp.

To enable text segmentation when ModeModeModeModeModemode = 'manual'"manual""manual""manual""manual""manual", reasonable parameters for the text model, including the expected character height and width, must be set using set_text_model_paramset_text_model_paramSetTextModelParamset_text_model_paramSetTextModelParamSetTextModelParam. In this case, the value of OCRClassifierOCRClassifierOCRClassifierOCRClassifierOCRClassifierOCRClassifier is ignored.

The parameters of the TextModelTextModelTextModelTextModelTextModeltextModel can be set and queried with set_text_model_paramset_text_model_paramSetTextModelParamset_text_model_paramSetTextModelParamSetTextModelParam and get_text_model_paramget_text_model_paramGetTextModelParamget_text_model_paramGetTextModelParamGetTextModelParam.

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

Parallelization

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.

Parameters

ModeModeModeModeModemode (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

The Mode of the text model.

Default value: 'auto' "auto" "auto" "auto" "auto" "auto"

List of values: 'auto'"auto""auto""auto""auto""auto", 'manual'"manual""manual""manual""manual""manual"

OCRClassifierOCRClassifierOCRClassifierOCRClassifierOCRClassifierOCRClassifier (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong) (BSTR / Hlong) (char* / Hlong)

OCR Classifier.

Default value: 'Universal_Rej.occ' "Universal_Rej.occ" "Universal_Rej.occ" "Universal_Rej.occ" "Universal_Rej.occ" "Universal_Rej.occ"

Suggested values: 'Document_Rej.omc'"Document_Rej.omc""Document_Rej.omc""Document_Rej.omc""Document_Rej.omc""Document_Rej.omc", 'Document_0-9_Rej.omc'"Document_0-9_Rej.omc""Document_0-9_Rej.omc""Document_0-9_Rej.omc""Document_0-9_Rej.omc""Document_0-9_Rej.omc", 'Document_0-9A-Z_Rej.omc'"Document_0-9A-Z_Rej.omc""Document_0-9A-Z_Rej.omc""Document_0-9A-Z_Rej.omc""Document_0-9A-Z_Rej.omc""Document_0-9A-Z_Rej.omc", 'Document_A-Z+_Rej.omc'"Document_A-Z+_Rej.omc""Document_A-Z+_Rej.omc""Document_A-Z+_Rej.omc""Document_A-Z+_Rej.omc""Document_A-Z+_Rej.omc", 'DotPrint_Rej.omc'"DotPrint_Rej.omc""DotPrint_Rej.omc""DotPrint_Rej.omc""DotPrint_Rej.omc""DotPrint_Rej.omc", 'DotPrint_0-9_Rej.omc'"DotPrint_0-9_Rej.omc""DotPrint_0-9_Rej.omc""DotPrint_0-9_Rej.omc""DotPrint_0-9_Rej.omc""DotPrint_0-9_Rej.omc", 'DotPrint_0-9+_Rej.omc'"DotPrint_0-9+_Rej.omc""DotPrint_0-9+_Rej.omc""DotPrint_0-9+_Rej.omc""DotPrint_0-9+_Rej.omc""DotPrint_0-9+_Rej.omc", 'DotPrint_0-9A-Z_Rej.omc'"DotPrint_0-9A-Z_Rej.omc""DotPrint_0-9A-Z_Rej.omc""DotPrint_0-9A-Z_Rej.omc""DotPrint_0-9A-Z_Rej.omc""DotPrint_0-9A-Z_Rej.omc", 'DotPrint_A-Z+_Rej.omc'"DotPrint_A-Z+_Rej.omc""DotPrint_A-Z+_Rej.omc""DotPrint_A-Z+_Rej.omc""DotPrint_A-Z+_Rej.omc""DotPrint_A-Z+_Rej.omc", 'HandWritten_0-9_Rej.omc'"HandWritten_0-9_Rej.omc""HandWritten_0-9_Rej.omc""HandWritten_0-9_Rej.omc""HandWritten_0-9_Rej.omc""HandWritten_0-9_Rej.omc", 'Industrial_Rej.omc'"Industrial_Rej.omc""Industrial_Rej.omc""Industrial_Rej.omc""Industrial_Rej.omc""Industrial_Rej.omc", 'Industrial_0-9_Rej.omc'"Industrial_0-9_Rej.omc""Industrial_0-9_Rej.omc""Industrial_0-9_Rej.omc""Industrial_0-9_Rej.omc""Industrial_0-9_Rej.omc", 'Industrial_0-9+_Rej.omc'"Industrial_0-9+_Rej.omc""Industrial_0-9+_Rej.omc""Industrial_0-9+_Rej.omc""Industrial_0-9+_Rej.omc""Industrial_0-9+_Rej.omc", 'Industrial_0-9A-Z_Rej.omc'"Industrial_0-9A-Z_Rej.omc""Industrial_0-9A-Z_Rej.omc""Industrial_0-9A-Z_Rej.omc""Industrial_0-9A-Z_Rej.omc""Industrial_0-9A-Z_Rej.omc", 'Industrial_A-Z+_Rej.omc'"Industrial_A-Z+_Rej.omc""Industrial_A-Z+_Rej.omc""Industrial_A-Z+_Rej.omc""Industrial_A-Z+_Rej.omc""Industrial_A-Z+_Rej.omc", 'OCRA_Rej.omc'"OCRA_Rej.omc""OCRA_Rej.omc""OCRA_Rej.omc""OCRA_Rej.omc""OCRA_Rej.omc", 'OCRA_0-9_Rej.omc'"OCRA_0-9_Rej.omc""OCRA_0-9_Rej.omc""OCRA_0-9_Rej.omc""OCRA_0-9_Rej.omc""OCRA_0-9_Rej.omc", 'OCRA_0-9A-Z_Rej.omc'"OCRA_0-9A-Z_Rej.omc""OCRA_0-9A-Z_Rej.omc""OCRA_0-9A-Z_Rej.omc""OCRA_0-9A-Z_Rej.omc""OCRA_0-9A-Z_Rej.omc", 'OCRA_A-Z+_Rej.omc'"OCRA_A-Z+_Rej.omc""OCRA_A-Z+_Rej.omc""OCRA_A-Z+_Rej.omc""OCRA_A-Z+_Rej.omc""OCRA_A-Z+_Rej.omc", 'OCRB_Rej.omc'"OCRB_Rej.omc""OCRB_Rej.omc""OCRB_Rej.omc""OCRB_Rej.omc""OCRB_Rej.omc", 'OCRB_0-9_Rej.omc'"OCRB_0-9_Rej.omc""OCRB_0-9_Rej.omc""OCRB_0-9_Rej.omc""OCRB_0-9_Rej.omc""OCRB_0-9_Rej.omc", 'OCRB_0-9A-Z_Rej.omc'"OCRB_0-9A-Z_Rej.omc""OCRB_0-9A-Z_Rej.omc""OCRB_0-9A-Z_Rej.omc""OCRB_0-9A-Z_Rej.omc""OCRB_0-9A-Z_Rej.omc", 'OCRB_A-Z+_Rej.omc'"OCRB_A-Z+_Rej.omc""OCRB_A-Z+_Rej.omc""OCRB_A-Z+_Rej.omc""OCRB_A-Z+_Rej.omc""OCRB_A-Z+_Rej.omc", 'OCRB_passport_Rej.omc'"OCRB_passport_Rej.omc""OCRB_passport_Rej.omc""OCRB_passport_Rej.omc""OCRB_passport_Rej.omc""OCRB_passport_Rej.omc", 'Pharma_Rej.omc'"Pharma_Rej.omc""Pharma_Rej.omc""Pharma_Rej.omc""Pharma_Rej.omc""Pharma_Rej.omc", 'Pharma_0-9_Rej.omc'"Pharma_0-9_Rej.omc""Pharma_0-9_Rej.omc""Pharma_0-9_Rej.omc""Pharma_0-9_Rej.omc""Pharma_0-9_Rej.omc", 'Pharma_0-9+_Rej.omc'"Pharma_0-9+_Rej.omc""Pharma_0-9+_Rej.omc""Pharma_0-9+_Rej.omc""Pharma_0-9+_Rej.omc""Pharma_0-9+_Rej.omc", 'Pharma_0-9A-Z_Rej.omc'"Pharma_0-9A-Z_Rej.omc""Pharma_0-9A-Z_Rej.omc""Pharma_0-9A-Z_Rej.omc""Pharma_0-9A-Z_Rej.omc""Pharma_0-9A-Z_Rej.omc", 'SEMI_Rej.omc'"SEMI_Rej.omc""SEMI_Rej.omc""SEMI_Rej.omc""SEMI_Rej.omc""SEMI_Rej.omc", 'Universal_Rej.occ'"Universal_Rej.occ""Universal_Rej.occ""Universal_Rej.occ""Universal_Rej.occ""Universal_Rej.occ", 'Universal_0-9_Rej.occ'"Universal_0-9_Rej.occ""Universal_0-9_Rej.occ""Universal_0-9_Rej.occ""Universal_0-9_Rej.occ""Universal_0-9_Rej.occ", 'Universal_0-9+_Rej.occ'"Universal_0-9+_Rej.occ""Universal_0-9+_Rej.occ""Universal_0-9+_Rej.occ""Universal_0-9+_Rej.occ""Universal_0-9+_Rej.occ", 'Universal_0-9A-Z_Rej.occ'"Universal_0-9A-Z_Rej.occ""Universal_0-9A-Z_Rej.occ""Universal_0-9A-Z_Rej.occ""Universal_0-9A-Z_Rej.occ""Universal_0-9A-Z_Rej.occ", 'Universal_0-9A-Z+_Rej.occ'"Universal_0-9A-Z+_Rej.occ""Universal_0-9A-Z+_Rej.occ""Universal_0-9A-Z+_Rej.occ""Universal_0-9A-Z+_Rej.occ""Universal_0-9A-Z+_Rej.occ", 'Universal_A-Z+_Rej.occ'"Universal_A-Z+_Rej.occ""Universal_A-Z+_Rej.occ""Universal_A-Z+_Rej.occ""Universal_A-Z+_Rej.occ""Universal_A-Z+_Rej.occ"

TextModelTextModelTextModelTextModelTextModeltextModel (output_control)  text_model HTextModel, HTupleHTupleHTextModel, HTupleHTextModelX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

New text model.

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)
clear_text_result (TextResultID)
clear_text_model (TextModel)

Result

create_text_model_readercreate_text_model_readerCreateTextModelReadercreate_text_model_readerCreateTextModelReaderCreateTextModelReader returns the value 2 (H_MSG_TRUE).

Possible Successors

set_text_model_paramset_text_model_paramSetTextModelParamset_text_model_paramSetTextModelParamSetTextModelParam, get_text_model_paramget_text_model_paramGetTextModelParamget_text_model_paramGetTextModelParamGetTextModelParam, find_textfind_textFindTextfind_textFindTextFindText

See also

clear_text_modelclear_text_modelClearTextModelclear_text_modelClearTextModelClearTextModel

Module

OCR/OCV


ClassesClassesClassesClasses | | | | Operators