ClassesClassesClassesClasses | | | | Operators

write_ocr_trainfwrite_ocr_trainfWriteOcrTrainfwrite_ocr_trainfWriteOcrTrainfWriteOcrTrainf (Operator)

Name

write_ocr_trainfwrite_ocr_trainfWriteOcrTrainfwrite_ocr_trainfWriteOcrTrainfWriteOcrTrainf — Storing of training characters into a file.

Signature

write_ocr_trainf(Character, Image : : Class, TrainingFile : )

Herror write_ocr_trainf(const Hobject Character, const Hobject Image, const char* Class, const char* TrainingFile)

Herror T_write_ocr_trainf(const Hobject Character, const Hobject Image, const Htuple Class, const Htuple TrainingFile)

Herror write_ocr_trainf(Hobject Character, Hobject Image, const HTuple& Class, const HTuple& TrainingFile)

void HRegion::WriteOcrTrainf(const HImage& Image, const HTuple& Class, const HTuple& TrainingFile) const

void HRegionArray::WriteOcrTrainf(const HImage& Image, const HTuple& Class, const HTuple& TrainingFile) const

void WriteOcrTrainf(const HObject& Character, const HObject& Image, const HTuple& Class, const HTuple& TrainingFile)

void HRegion::WriteOcrTrainf(const HImage& Image, const HTuple& Class, const HString& TrainingFile) const

void HRegion::WriteOcrTrainf(const HImage& Image, const HString& Class, const HString& TrainingFile) const

void HRegion::WriteOcrTrainf(const HImage& Image, const char* Class, const char* TrainingFile) const

void HOperatorSetX.WriteOcrTrainf(
[in] IHUntypedObjectX* Character, [in] IHUntypedObjectX* Image, [in] VARIANT Class, [in] VARIANT TrainingFile)

void HRegionX.WriteOcrTrainf(
[in] IHImageX* Image, [in] VARIANT Class, [in] BSTR TrainingFile)

static void HOperatorSet.WriteOcrTrainf(HObject character, HObject image, HTuple classVal, HTuple trainingFile)

void HRegion.WriteOcrTrainf(HImage image, HTuple classVal, string trainingFile)

void HRegion.WriteOcrTrainf(HImage image, string classVal, string trainingFile)

Description

The operator write_ocr_trainfwrite_ocr_trainfWriteOcrTrainfwrite_ocr_trainfWriteOcrTrainfWriteOcrTrainf serves to prepare the training with the operator trainf_ocr_class_mlptrainf_ocr_class_mlpTrainfOcrClassMlptrainf_ocr_class_mlpTrainfOcrClassMlpTrainfOcrClassMlp, trainf_ocr_class_svmtrainf_ocr_class_svmTrainfOcrClassSvmtrainf_ocr_class_svmTrainfOcrClassSvmTrainfOcrClassSvm, or trainf_ocr_class_boxtrainf_ocr_class_boxTrainfOcrClassBoxtrainf_ocr_class_boxTrainfOcrClassBoxTrainfOcrClassBox. 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 CharacterCharacterCharacterCharacterCharactercharacter the corresponding class name must be specified in ClassClassClassClassClassclassVal. The gray values are passed via the parameter ImageImageImageImageImageimage. If no file extension is specified in TrainingFileTrainingFileTrainingFileTrainingFileTrainingFiletrainingFile the extension '.trf' is appended to the file name. The version of the file format used for writing data can be defined by the parameter 'ocr_trainf_version'"ocr_trainf_version""ocr_trainf_version""ocr_trainf_version""ocr_trainf_version""ocr_trainf_version" of the operator set_systemset_systemSetSystemset_systemSetSystemSetSystem.

Parallelization

Parameters

CharacterCharacterCharacterCharacterCharactercharacter (input_object)  region(-array) objectHRegionHRegionHRegionHRegionXHobject

Characters to be trained.

ImageImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHImageHImageXHobject (byte / uint2)

Gray values of the characters.

ClassClassClassClassClassclassVal (input_control)  string(-array) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Class (name) of the characters.

TrainingFileTrainingFileTrainingFileTrainingFileTrainingFiletrainingFile (input_control)  filename.write HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Name of the training file.

Default value: 'train_ocr' "train_ocr" "train_ocr" "train_ocr" "train_ocr" "train_ocr"

File extension: .trf

Example (C)

char       name[128];
HTuple     Class,Name;

read_image(&Image,"character.tiff");
bin_threshold(Image,&Dark);
connection(Dark,&Character);
count_obj(Character,&num);
create_tuple(&Class,num);
open_window(0,0,-1,-1,0,"","",&WindowHandle);
set_color(WindowHandle,"red");
for (i=0; i<num; i++) {
  select_obj(Character,&SingleCharacter,i);
  clear_window(WindowHandle);
  disp_region(SingleCharacter,WindowHandle);
  printf("class of character %d ?\n",i);
  scanf("%s\n",name);
  set_s(Class,name,i);
}
create_tuple(&Name,1);
set_s(Class,Name,"trainfile");
T_write_ocr_trainf(Character,Image,Class,Name);

Result

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

Possible Predecessors

thresholdthresholdThresholdthresholdThresholdThreshold, connectionconnectionConnectionconnectionConnectionConnection, create_ocr_class_boxcreate_ocr_class_boxCreateOcrClassBoxcreate_ocr_class_boxCreateOcrClassBoxCreateOcrClassBox, read_ocrread_ocrReadOcrread_ocrReadOcrReadOcr

Possible Successors

trainf_ocr_class_mlptrainf_ocr_class_mlpTrainfOcrClassMlptrainf_ocr_class_mlpTrainfOcrClassMlpTrainfOcrClassMlp, trainf_ocr_class_svmtrainf_ocr_class_svmTrainfOcrClassSvmtrainf_ocr_class_svmTrainfOcrClassSvmTrainfOcrClassSvm, trainf_ocr_class_boxtrainf_ocr_class_boxTrainfOcrClassBoxtrainf_ocr_class_boxTrainfOcrClassBoxTrainfOcrClassBox, info_ocr_class_boxinfo_ocr_class_boxInfoOcrClassBoxinfo_ocr_class_boxInfoOcrClassBoxInfoOcrClassBox, write_ocrwrite_ocrWriteOcrwrite_ocrWriteOcrWriteOcr, do_ocr_multido_ocr_multiDoOcrMultido_ocr_multiDoOcrMultiDoOcrMulti, do_ocr_singledo_ocr_singleDoOcrSingledo_ocr_singleDoOcrSingleDoOcrSingle

Module

OCR/OCV


ClassesClassesClassesClasses | | | | Operators