do_ocr_multi_class_knnT_do_ocr_multi_class_knnDoOcrMultiClassKnnDoOcrMultiClassKnndo_ocr_multi_class_knn (Operator)
Name
do_ocr_multi_class_knnT_do_ocr_multi_class_knnDoOcrMultiClassKnnDoOcrMultiClassKnndo_ocr_multi_class_knn
— Classify multiple characters with an k-NN classifier.
Signature
void DoOcrMultiClassKnn(const HObject& Character, const HObject& Image, const HTuple& OCRHandle, HTuple* Class, HTuple* Confidence)
HTuple HRegion::DoOcrMultiClassKnn(const HImage& Image, const HOCRKnn& OCRHandle, HTuple* Confidence) const
HString HRegion::DoOcrMultiClassKnn(const HImage& Image, const HOCRKnn& OCRHandle, double* Confidence) const
HTuple HOCRKnn::DoOcrMultiClassKnn(const HRegion& Character, const HImage& Image, HTuple* Confidence) const
HString HOCRKnn::DoOcrMultiClassKnn(const HRegion& Character, const HImage& Image, double* Confidence) const
static void HOperatorSet.DoOcrMultiClassKnn(HObject character, HObject image, HTuple OCRHandle, out HTuple classVal, out HTuple confidence)
HTuple HRegion.DoOcrMultiClassKnn(HImage image, HOCRKnn OCRHandle, out HTuple confidence)
string HRegion.DoOcrMultiClassKnn(HImage image, HOCRKnn OCRHandle, out double confidence)
HTuple HOCRKnn.DoOcrMultiClassKnn(HRegion character, HImage image, out HTuple confidence)
string HOCRKnn.DoOcrMultiClassKnn(HRegion character, HImage image, out double confidence)
Description
do_ocr_multi_class_knndo_ocr_multi_class_knnDoOcrMultiClassKnnDoOcrMultiClassKnndo_ocr_multi_class_knn
computes the best class for each of
the characters given by the regions CharacterCharacterCharactercharactercharacter
and the gray
values ImageImageImageimageimage
with the k-NN classifier OCRHandleOCRHandleOCRHandleOCRHandleocrhandle
and
returns the classes in ClassClassClassclassValclass
and the corresponding
confidence of the classes in ConfidenceConfidenceConfidenceconfidenceconfidence
.
The confidences lie between 0.0 and 1.0. The larger the value, the
more reliable is the classification of the single characters.
In contrast to do_ocr_single_class_knndo_ocr_single_class_knnDoOcrSingleClassKnnDoOcrSingleClassKnndo_ocr_single_class_knn
,
do_ocr_multi_class_knndo_ocr_multi_class_knnDoOcrMultiClassKnnDoOcrMultiClassKnndo_ocr_multi_class_knn
can classify multiple characters in
one call, and therefore typically is faster than a loop that uses
do_ocr_single_class_knndo_ocr_single_class_knnDoOcrSingleClassKnnDoOcrSingleClassKnndo_ocr_single_class_knn
to classify single characters.
However, do_ocr_multi_class_knndo_ocr_multi_class_knnDoOcrMultiClassKnnDoOcrMultiClassKnndo_ocr_multi_class_knn
can only return the best
class of each character.
Before calling do_ocr_multi_class_knndo_ocr_multi_class_knnDoOcrMultiClassKnnDoOcrMultiClassKnndo_ocr_multi_class_knn
, the classifier must be
trained with trainf_ocr_class_knntrainf_ocr_class_knnTrainfOcrClassKnnTrainfOcrClassKnntrainf_ocr_class_knn
.
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 of the characters.
OCRHandleOCRHandleOCRHandleOCRHandleocrhandle
(input_control) ocr_knn →
HOCRKnn, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Handle of the k-NN classifier.
ClassClassClassclassValclass
(output_control) string(-array) →
HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Result of classifying the characters with the
k-NN.
Number of elements:
Class == Character
ConfidenceConfidenceConfidenceconfidenceconfidence
(output_control) real(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Confidence of the class of the characters.
Number of elements:
Confidence == Character
Result
If the parameters are valid, the operator
do_ocr_multi_class_knndo_ocr_multi_class_knnDoOcrMultiClassKnnDoOcrMultiClassKnndo_ocr_multi_class_knn
returns the value 2 (
H_MSG_TRUE)
. If
necessary, an exception is raised.
Possible Predecessors
trainf_ocr_class_knntrainf_ocr_class_knnTrainfOcrClassKnnTrainfOcrClassKnntrainf_ocr_class_knn
,
read_ocr_class_knnread_ocr_class_knnReadOcrClassKnnReadOcrClassKnnread_ocr_class_knn
Alternatives
do_ocr_single_class_knndo_ocr_single_class_knnDoOcrSingleClassKnnDoOcrSingleClassKnndo_ocr_single_class_knn
See also
create_ocr_class_knncreate_ocr_class_knnCreateOcrClassKnnCreateOcrClassKnncreate_ocr_class_knn
,
classify_class_knnclassify_class_knnClassifyClassKnnClassifyClassKnnclassify_class_knn
Module
OCR/OCV