Skip to content

do_ocr_multiDoOcrMultiDoOcrMultido_ocr_multiT_do_ocr_multi🔗

Short description🔗

do_ocr_multiDoOcrMultiDoOcrMultido_ocr_multiT_do_ocr_multi — Classify characters.

Warning🔗

do_ocr_multiDoOcrMulti 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( region Character, image Image, ocr_box OcrHandle, out string Class, out real Confidence )void DoOcrMulti( const HObject& Character, const HObject& Image, const HTuple& OcrHandle, HTuple* Class, HTuple* Confidence )static void HOperatorSet.DoOcrMulti( HObject character, HObject image, HTuple ocrHandle, out HTuple classVal, out HTuple 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]Herror T_do_ocr_multi( 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

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 )

Description🔗

The operator do_ocr_multiDoOcrMulti assigns a class to every Charactercharactercharacter (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 Imageimageimage. For each character the corresponding class will be returned in ClassclassValclass and a confidence value will be returned in Confidenceconfidenceconfidence. The confidence value indicates the similarity between the input pattern and the assigned character.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

Parameters🔗

Charactercharactercharacter (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Characters to be recognized.

Imageimageimage (input_object) singlechannelimage → object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

Gray values for the characters.

OcrHandleocrHandleocr_handle (input_control) ocr_box → (handle)HTuple (HHandle)HOCRBox, HTuple (IntPtr)HHandleHtuple (handle)

ID of the OCR classifier.

ClassclassValclass (output_control) string(-array) → (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Class (name) of the characters.

Number of elements: Class == Character

Confidenceconfidenceconfidence (output_control) real(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (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_singleDoOcrSingle returns the value 2 (H_MSG_TRUE). Otherwise an exception will be raised.

Combinations with other operators🔗

Combinations

Possible predecessors

traind_ocr_class_boxTraindOcrClassBox, trainf_ocr_class_boxTrainfOcrClassBox, read_ocrReadOcr, connectionConnection, sort_regionSortRegion

Alternatives

do_ocr_singleDoOcrSingle

See also

write_ocrWriteOcr

Module🔗

OCR/OCV