do_ocr_single🔗
Short description🔗
do_ocr_single — Classify one character.
Warning🔗
do_ocr_single 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_single( region Character, image Image, ocr_box OcrHandle, out string Classes, out real Confidences )
Description🔗
The operator do_ocr_single assigns classes to the
Character (characters).
For gray value features gray values of the surrounding rectangles of the
regions will be used. The gray values will be taken from the
parameter Image. For each character the two classes
with the highest confidences will be returned in
Classes. The corresponding confidences will be
returned in Confidences. 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).
-
Processed without parallelization.
Parameters🔗
Character (input_object) region → object
Character to be recognized.
Image (input_object) singlechannelimage → object (byte / uint2)
Gray values of the characters.
OcrHandle (input_control) ocr_box → (handle)
ID of the OCR classifier.
Classes (output_control) string-array → (string)
Classes (names) of the characters.
Number of elements: 2
Confidences (output_control) real-array → (real)
Confidence values of the characters.
Number of elements: 2
Example🔗
(C)
HTuple Classes,Confidences\;
Hlong orc_handle\;
HTuple OcrHandle\;
read_ocr("testnet",&orc_handle)\;
create_tuple(&OcrHandle,1)\;
set_i(OcrHandle,orc_handle,0)\;
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)\;
T_do_ocr_single(SingleCharacter,Image,
OcrHandle,&Classes,&Confidences)\;
printf("best = %s (%g)\n",
get_s(Classes,0),get_d(Confidences,0))\;
printf("second = %s (%g)\n\n",
get_s(Classes,1),get_d(Confidences,1))\;
}
Result🔗
If the input parameters are correct, the operator
do_ocr_single returns the value 2 (H_MSG_TRUE).
Otherwise an exception will be raised.
Combinations with other operators🔗
Combinations
Possible predecessors
traind_ocr_class_box, trainf_ocr_class_box, read_ocr, connection, sort_region
Alternatives
See also
Module🔗
OCR/OCV