Skip to content

protect_ocr_trainfProtectOcrTrainfProtectOcrTrainfprotect_ocr_trainfprotect_ocr_trainf🔗

Short description🔗

protect_ocr_trainfProtectOcrTrainfProtectOcrTrainfprotect_ocr_trainfprotect_ocr_trainf — Protection of training data.

Signature🔗

protect_ocr_trainf( filename.read TrainingFile, string Password, filename.write TrainingFileProtected )void ProtectOcrTrainf( const HTuple& TrainingFile, const HTuple& Password, const HTuple& TrainingFileProtected )static void HOperatorSet.ProtectOcrTrainf( HTuple trainingFile, HTuple password, HTuple trainingFileProtected )def protect_ocr_trainf( training_file: str, password: MaybeSequence[str], training_file_protected: str ) -> None

Herror protect_ocr_trainf( const char* TrainingFile, const char* Password, const char* TrainingFileProtected )

Herror T_protect_ocr_trainf( const Htuple TrainingFile, const Htuple Password, const Htuple TrainingFileProtected )

static void HRegion::ProtectOcrTrainf( const HString& TrainingFile, const HTuple& Password, const HString& TrainingFileProtected )

static void HRegion::ProtectOcrTrainf( const HString& TrainingFile, const HString& Password, const HString& TrainingFileProtected )

static void HRegion::ProtectOcrTrainf( const char* TrainingFile, const char* Password, const char* TrainingFileProtected )

static void HRegion::ProtectOcrTrainf( const wchar_t* TrainingFile, const wchar_t* Password, const wchar_t* TrainingFileProtected ) (Windows only)

static void HRegion.ProtectOcrTrainf( string trainingFile, HTuple password, string trainingFileProtected )

static void HRegion.ProtectOcrTrainf( string trainingFile, string password, string trainingFileProtected )

Description🔗

Obtaining training data for an OCR classifier can be a complicated and time consuming activity. Thus, training data is valuable and there might be the necessity to protect its usage. The general idea is to prevent protected OCR training data from being reviewed or modified in any way and to ensure that its usage, e.g., training an OCR classifier, is restricted by a user password.

The approach in HALCON is to obtain OCR training data in the usual way, then write it to an unprotected OCR training file using, e.g., write_ocr_trainfWriteOcrTrainf, and afterwards create a new file containing the OCR training data protected with a user password. Protected training files can be used with a set of special operators that also require the correct password in order to be able to process the data, e.g., for training an OCR classifier.

It is important to keep in mind that data in a protected OCR training file cannot be reviewed or modified in any way, thus it is important to keep the original, unprotected, training data files.

Protected OCR training data can be used for training of multilayer perceptron (MLP) classifiers and support vector machine (SVM) classifiers.

protect_ocr_trainfProtectOcrTrainf protects the OCR training data contained in the file TrainingFiletrainingFiletraining_file and writes it to the protected training data file TrainingFileProtectedtrainingFileProtectedtraining_file_protected. The protection is done with the user password Passwordpasswordpassword. The same password has to be used afterwards in order to use the protected OCR training data, e.g., by the operators trainf_ocr_class_mlp_protectedTrainfOcrClassMlpProtected or read_ocr_trainf_names_protectedReadOcrTrainfNamesProtected. Empty passwords (or passwords containing the empty string) are not allowed. If the number of passwords Passwordpasswordpassword equals 1, then every output file TrainingFileProtectedtrainingFileProtectedtraining_file_protected is protected with that password, otherwise the number of passwords has to be equal to the number of input and output files and the output file at position n is protected with the password at position n.

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🔗

TrainingFiletrainingFiletraining_file (input_control) filename.read → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Names of the training files.

Default: ''""
File extension: .trf, .otr

Passwordpasswordpassword (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Passwords for protecting the training files.

TrainingFileProtectedtrainingFileProtectedtraining_file_protected (input_control) filename.write → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Names of the protected training files.

File extension: .trf

Result🔗

If the parameters are correct, the operator protect_ocr_trainfProtectOcrTrainf returns the value 2 (H_MSG_TRUE). Otherwise an exception will be raised.

Combinations with other operators🔗

Combinations

Possible predecessors

write_ocr_trainfWriteOcrTrainf, append_ocr_trainfAppendOcrTrainf, concat_ocr_trainfConcatOcrTrainf

Possible successors

read_ocr_trainf_names_protectedReadOcrTrainfNamesProtected, trainf_ocr_class_mlp_protectedTrainfOcrClassMlpProtected, trainf_ocr_class_svm_protectedTrainfOcrClassSvmProtected, select_feature_set_trainf_mlp_protectedSelectFeatureSetTrainfMlpProtected, select_feature_set_trainf_svm_protectedSelectFeatureSetTrainfSvmProtected

See also

select_feature_set_trainf_mlpSelectFeatureSetTrainfMlp

Module🔗

OCR/OCV