Skip to content

write_ocr_trainf_imageWriteOcrTrainfImageWriteOcrTrainfImagewrite_ocr_trainf_imagewrite_ocr_trainf_image🔗

Short description🔗

write_ocr_trainf_imageWriteOcrTrainfImageWriteOcrTrainfImagewrite_ocr_trainf_imagewrite_ocr_trainf_image — Write characters into a training file.

Signature🔗

write_ocr_trainf_image( image Character, string Class, filename.write TrainingFile )void WriteOcrTrainfImage( const HObject& Character, const HTuple& Class, const HTuple& TrainingFile )static void HOperatorSet.WriteOcrTrainfImage( HObject character, HTuple classVal, HTuple trainingFile )def write_ocr_trainf_image( character: HObject, class_val: MaybeSequence[str], training_file: str ) -> None

Herror write_ocr_trainf_image( const Hobject Character, const char* Class, const char* TrainingFile )

Herror T_write_ocr_trainf_image( const Hobject Character, const Htuple Class, const Htuple TrainingFile )

void HImage::WriteOcrTrainfImage( const HTuple& Class, const HString& TrainingFile ) const

void HImage::WriteOcrTrainfImage( const HString& Class, const HString& TrainingFile ) const

void HImage::WriteOcrTrainfImage( const char* Class, const char* TrainingFile ) const

void HImage::WriteOcrTrainfImage( const wchar_t* Class, const wchar_t* TrainingFile ) const (Windows only)

void HImage.WriteOcrTrainfImage( HTuple classVal, string trainingFile )

void HImage.WriteOcrTrainfImage( string classVal, string trainingFile )

Description🔗

The operator write_ocr_trainf_imageWriteOcrTrainfImage is used to prepare the training with the operator trainf_ocr_class_mlpTrainfOcrClassMlp or trainf_ocr_class_svmTrainfOcrClassSvm. Hereby regions, representing characters, including their gray values (region and pixel) and the corresponding class name will be written into a file. An arbitrary number of regions within one image is supported. For each character (region) in Charactercharactercharacter the corresponding class name must be specified in ClassclassValclass. If no file extension is specified in TrainingFiletrainingFiletraining_file the extension ‘.trf’ is appended to the file name. In contrast to write_ocr_trainfWriteOcrTrainf one image per character is passed. The domain of this image defines the pixels which belong to the character. The file format can be defined by the parameter 'ocr_trainf_version'"ocr_trainf_version" of the operator set_systemSetSystem.

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🔗

Charactercharactercharacter (input_object) singlechannelimage(-array) → object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

Characters to be trained.

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

Class (name) of the characters.

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

Name of the training file.

Default: 'train_ocr'"train_ocr"
File extension: .trf

Result🔗

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

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, connectionConnection, read_ocr_trainfReadOcrTrainf

Possible successors

trainf_ocr_class_mlpTrainfOcrClassMlp, trainf_ocr_class_svmTrainfOcrClassSvm

Alternatives

write_ocr_trainfWriteOcrTrainf, append_ocr_trainfAppendOcrTrainf

Module🔗

OCR/OCV