do_ocr_multiT_do_ocr_multiDoOcrMultiDoOcrMultido_ocr_multi (Operator)

Name

do_ocr_multiT_do_ocr_multiDoOcrMultiDoOcrMultido_ocr_multi — Classify characters.

Warning

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

Signature

do_ocr_multi(Character, Image : : OcrHandle : Class, Confidence)

Herror T_do_ocr_multi(const Hobject Character, const Hobject Image, const Htuple OcrHandle, Htuple* Class, Htuple* Confidence)

void DoOcrMulti(const HObject& Character, const HObject& Image, const HTuple& OcrHandle, HTuple* Class, HTuple* Confidence)

HTuple HRegion::DoOcrMulti(const HImage& Image, const HOCRBox& OcrHandle, HTuple* Confidence) const

HString HRegion::DoOcrMulti(const HImage& Image, const HOCRBox& OcrHandle, double* Confidence) const

HTuple HOCRBox::DoOcrMulti(const HRegion& Character, const HImage& Image, HTuple* Confidence) const

HString HOCRBox::DoOcrMulti(const HRegion& Character, const HImage& Image, double* Confidence) const

static void HOperatorSet.DoOcrMulti(HObject character, HObject image, HTuple ocrHandle, out HTuple classVal, out HTuple confidence)

HTuple HRegion.DoOcrMulti(HImage image, HOCRBox ocrHandle, out HTuple confidence)

string HRegion.DoOcrMulti(HImage image, HOCRBox ocrHandle, out double confidence)

HTuple HOCRBox.DoOcrMulti(HRegion character, HImage image, out HTuple confidence)

string HOCRBox.DoOcrMulti(HRegion character, HImage image, out double confidence)

def do_ocr_multi(character: HObject, image: HObject, ocr_handle: HHandle) -> Tuple[Sequence[str], Sequence[float]]

def do_ocr_multi_s(character: HObject, image: HObject, ocr_handle: HHandle) -> Tuple[str, float]

Description

The operator do_ocr_multido_ocr_multiDoOcrMultiDoOcrMultiDoOcrMultido_ocr_multi assigns a class to every CharacterCharacterCharacterCharactercharactercharacter (character). For gray value features the gray values from the surrounding rectangles of the regions are used. The gray values will be taken from the parameter ImageImageImageImageimageimage. For each character the corresponding class will be returned in ClassClassClassClassclassValclass and a confidence value will be returned in ConfidenceConfidenceConfidenceConfidenceconfidenceconfidence. The confidence value indicates the similarity between the input pattern and the assigned character.

Execution Information

Parameters

CharacterCharacterCharacterCharactercharactercharacter (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Characters to be recognized.

ImageImageImageImageimageimage (input_object)  singlechannelimage objectHImageHObjectHImageHobject (byte / uint2)

Gray values for the characters.

OcrHandleOcrHandleOcrHandleOcrHandleocrHandleocr_handle (input_control)  ocr_box HOCRBox, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

ID of the OCR classifier.

ClassClassClassClassclassValclass (output_control)  string(-array) HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Class (name) of the characters.

Number of elements: Class == Character

ConfidenceConfidenceConfidenceConfidenceconfidenceconfidence (output_control)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Confidence values of the characters.

Number of elements: Confidence == Character

Example (C)

char Class[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);
for (i=0; i<num; i++) {
  select_obj(Character,&SingleCharacter,i);
    do_ocr_multi(SingleCharacter,Image,orc_handle,&Class,NULL);
  smallest_rectangle1(SingleCharacter,NULL,&col,&row,);
  set_tposition(row,col);
  write_string(WindowHandle,Class);
}

Result

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

Possible Predecessors

traind_ocr_class_boxtraind_ocr_class_boxTraindOcrClassBoxTraindOcrClassBoxTraindOcrClassBoxtraind_ocr_class_box, trainf_ocr_class_boxtrainf_ocr_class_boxTrainfOcrClassBoxTrainfOcrClassBoxTrainfOcrClassBoxtrainf_ocr_class_box, read_ocrread_ocrReadOcrReadOcrReadOcrread_ocr, connectionconnectionConnectionConnectionConnectionconnection, sort_regionsort_regionSortRegionSortRegionSortRegionsort_region

Alternatives

do_ocr_singledo_ocr_singleDoOcrSingleDoOcrSingleDoOcrSingledo_ocr_single

See also

write_ocrwrite_ocrWriteOcrWriteOcrWriteOcrwrite_ocr

Module

OCR/OCV