do_ocr_multiT_do_ocr_multiDoOcrMultiDoOcrMultido_ocr_multi (Operator)
do_ocr_multiT_do_ocr_multiDoOcrMultiDoOcrMultido_ocr_multi
— Classify characters.
Warning
do_ocr_multido_ocr_multiDoOcrMultiDoOcrMultido_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
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)
Description
The operator do_ocr_multido_ocr_multiDoOcrMultiDoOcrMultido_ocr_multi
assigns a class to every
CharacterCharacterCharactercharactercharacter
(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
ImageImageImageimageimage
. For each character the corresponding class will be
returned in ClassClassClassclassValclass
and a confidence value will be
returned in ConfidenceConfidenceConfidenceconfidenceconfidence
. The confidence value indicates the
similarity between the input pattern and the assigned character.
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
Parameters
CharacterCharacterCharactercharactercharacter
(input_object) region(-array) →
objectHRegionHObjectHObjectHobject
Characters to be recognized.
ImageImageImageimageimage
(input_object) singlechannelimage →
objectHImageHObjectHObjectHobject (byte / uint2)
Gray values for the characters.
OcrHandleOcrHandleOcrHandleocrHandleocr_handle
(input_control) ocr_box →
HOCRBox, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
ID of the OCR classifier.
ClassClassClassclassValclass
(output_control) string(-array) →
HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Class (name) of the characters.
Number of elements:
Class == Character
ConfidenceConfidenceConfidenceconfidenceconfidence
(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_singleDoOcrSingleDoOcrSingledo_ocr_single
returns the value 2 (
H_MSG_TRUE)
.
Otherwise an exception will be raised.
Possible Predecessors
traind_ocr_class_boxtraind_ocr_class_boxTraindOcrClassBoxTraindOcrClassBoxtraind_ocr_class_box
,
trainf_ocr_class_boxtrainf_ocr_class_boxTrainfOcrClassBoxTrainfOcrClassBoxtrainf_ocr_class_box
,
read_ocrread_ocrReadOcrReadOcrread_ocr
,
connectionconnectionConnectionConnectionconnection
,
sort_regionsort_regionSortRegionSortRegionsort_region
Alternatives
do_ocr_singledo_ocr_singleDoOcrSingleDoOcrSingledo_ocr_single
See also
write_ocrwrite_ocrWriteOcrWriteOcrwrite_ocr
Module
OCR/OCV