ClassesClasses | | Operators

traind_ocr_class_boxT_traind_ocr_class_boxTraindOcrClassBoxTraindOcrClassBox (Operator)

Name

traind_ocr_class_boxT_traind_ocr_class_boxTraindOcrClassBoxTraindOcrClassBox — Train an OCR classifier by the input of regions.

Warning

traind_ocr_class_boxtraind_ocr_class_boxTraindOcrClassBoxTraindOcrClassBoxTraindOcrClassBox is obsolete and is only provided for reasons of backward compatibility. New applications should use the MLP, SVM or CNN based operators instead.

Signature

traind_ocr_class_box(Character, Image : : OcrHandle, Class : AvgConfidence)

Herror T_traind_ocr_class_box(const Hobject Character, const Hobject Image, const Htuple OcrHandle, const Htuple Class, Htuple* AvgConfidence)

void TraindOcrClassBox(const HObject& Character, const HObject& Image, const HTuple& OcrHandle, const HTuple& Class, HTuple* AvgConfidence)

double HRegion::TraindOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const HTuple& Class) const

double HRegion::TraindOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const HString& Class) const

double HRegion::TraindOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const char* Class) const

double HOCRBox::TraindOcrClassBox(const HRegion& Character, const HImage& Image, const HTuple& Class) const

double HOCRBox::TraindOcrClassBox(const HRegion& Character, const HImage& Image, const HString& Class) const

double HOCRBox::TraindOcrClassBox(const HRegion& Character, const HImage& Image, const char* Class) const

static void HOperatorSet.TraindOcrClassBox(HObject character, HObject image, HTuple ocrHandle, HTuple classVal, out HTuple avgConfidence)

double HRegion.TraindOcrClassBox(HImage image, HOCRBox ocrHandle, HTuple classVal)

double HRegion.TraindOcrClassBox(HImage image, HOCRBox ocrHandle, string classVal)

double HOCRBox.TraindOcrClassBox(HRegion character, HImage image, HTuple classVal)

double HOCRBox.TraindOcrClassBox(HRegion character, HImage image, string classVal)

Description

The operator traind_ocr_class_boxtraind_ocr_class_boxTraindOcrClassBoxTraindOcrClassBoxTraindOcrClassBox trains the classifier directly via the input of regions in an image. Any number of regions of an image can be passed. For each character (region) in CharacterCharacterCharacterCharactercharacter the corresponding name (class) ClassClassClassClassclassVal must be specified. The gray values are passed in ImageImageImageImageimage. When the procedure has finished the parameter AvgConfidenceAvgConfidenceAvgConfidenceAvgConfidenceavgConfidence provides information about the success of the training: It contains the average confidence of the trained characters measured by a re-classification. The confidence of mismatched characters is set to 0 (thus, the average confidence will be decreased significantly).

Execution Information

This operator modifies the state of the following input parameter:

The value of this parameter may not be shared across multiple threads without external synchronization.

Parameters

CharacterCharacterCharacterCharactercharacter (input_object)  region(-array) objectHRegionHRegionHobject

Characters to be trained.

ImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHobject (byte / uint2)

Gray values for the characters.

OcrHandleOcrHandleOcrHandleOcrHandleocrHandle (input_control, state is modified)  ocr_box HOCRBox, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

ID of the desired OCR-classifier.

ClassClassClassClassclassVal (input_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Class (name) of the characters.

Default value: 'a' "a" "a" "a" "a"

AvgConfidenceAvgConfidenceAvgConfidenceAvgConfidenceavgConfidence (output_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Average confidence during a re-classification of the trained characters.

Example (C)

char name[128];
Hlong orc_handle;

read_ocr("testnet",&orc_handle);
read_image(&Image,"character.tiff");
binary_threshold(Image,&Dark, 'otsu', 'dark', &UsedThreshold);
connection(Dark,&Character);
count_obj(Character,&num);
open_window(0,0,-1,-1,0,"","",&WindowHandle);
set_color(WindowHandle,"red");
for (i=0; i<num; i++) {
  select_obj(Character,&SingleCharacter,i);
  disp_region(SingleCharacter,WindowHandle);
  printf("class of character %d ?\n",i);
  scanf("%s\n",name);
  traind_ocr_class_box(SingleCharacter,Image,OcrHandle,name,&AvgConfidence);
}

Result

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

Possible Predecessors

create_ocr_class_boxcreate_ocr_class_boxCreateOcrClassBoxCreateOcrClassBoxCreateOcrClassBox, read_ocrread_ocrReadOcrReadOcrReadOcr

Possible Successors

write_ocrwrite_ocrWriteOcrWriteOcrWriteOcr, do_ocr_multido_ocr_multiDoOcrMultiDoOcrMultiDoOcrMulti, do_ocr_singledo_ocr_singleDoOcrSingleDoOcrSingleDoOcrSingle

Alternatives

trainf_ocr_class_boxtrainf_ocr_class_boxTrainfOcrClassBoxTrainfOcrClassBoxTrainfOcrClassBox

Module

OCR/OCV


ClassesClasses | | Operators