tesseract
3.03
|
#include <tessclassifier.h>
Public Member Functions | |
TessClassifier (bool pruner_only, tesseract::Classify *classify) | |
virtual | ~TessClassifier () |
virtual int | UnicharClassifySample (const TrainingSample &sample, Pix *page_pix, int debug, UNICHAR_ID keep_this, GenericVector< UnicharRating > *results) |
virtual const ShapeTable * | GetShapeTable () const |
virtual const UNICHARSET & | GetUnicharset () const |
virtual int | DisplayClassifyAs (const TrainingSample &sample, Pix *page_pix, int unichar_id, int index, PointerVector< ScrollView > *windows) |
Definition at line 36 of file tessclassifier.h.
tesseract::TessClassifier::TessClassifier | ( | bool | pruner_only, |
tesseract::Classify * | classify | ||
) | [inline] |
Definition at line 38 of file tessclassifier.h.
: pruner_only_(pruner_only), classify_(classify) {}
virtual tesseract::TessClassifier::~TessClassifier | ( | ) | [inline, virtual] |
Definition at line 40 of file tessclassifier.h.
{}
int tesseract::TessClassifier::DisplayClassifyAs | ( | const TrainingSample & | sample, |
Pix * | page_pix, | ||
int | unichar_id, | ||
int | index, | ||
PointerVector< ScrollView > * | windows | ||
) | [virtual] |
Reimplemented from tesseract::ShapeClassifier.
Definition at line 68 of file tessclassifier.cpp.
{ int shape_id = unichar_id; if (GetShapeTable() != NULL) shape_id = BestShapeForUnichar(sample, page_pix, unichar_id, NULL); if (shape_id < 0) return index; if (UnusedClassIdIn(classify_->PreTrainedTemplates, shape_id)) { tprintf("No built-in templates for class/shape %d\n", shape_id); return index; } classify_->ShowBestMatchFor(shape_id, sample.features(), sample.num_features()); return index; }
const ShapeTable * tesseract::TessClassifier::GetShapeTable | ( | ) | const [virtual] |
Implements tesseract::ShapeClassifier.
Definition at line 54 of file tessclassifier.cpp.
{ return classify_->shape_table(); }
const UNICHARSET & tesseract::TessClassifier::GetUnicharset | ( | ) | const [virtual] |
Reimplemented from tesseract::ShapeClassifier.
Definition at line 59 of file tessclassifier.cpp.
{ return classify_->unicharset; }
int tesseract::TessClassifier::UnicharClassifySample | ( | const TrainingSample & | sample, |
Pix * | page_pix, | ||
int | debug, | ||
UNICHAR_ID | keep_this, | ||
GenericVector< UnicharRating > * | results | ||
) | [virtual] |
Reimplemented from tesseract::ShapeClassifier.
Definition at line 31 of file tessclassifier.cpp.
{ int old_matcher_level = classify_->matcher_debug_level; int old_matcher_flags = classify_->matcher_debug_flags; int old_classify_level = classify_->classify_debug_level; if (debug) { // Explicitly set values of various control parameters to generate debug // output if required, restoring the old values after classifying. classify_->matcher_debug_level.set_value(2); classify_->matcher_debug_flags.set_value(25); classify_->classify_debug_level.set_value(3); } classify_->CharNormTrainingSample(pruner_only_, keep_this, sample, results); if (debug) { classify_->matcher_debug_level.set_value(old_matcher_level); classify_->matcher_debug_flags.set_value(old_matcher_flags); classify_->classify_debug_level.set_value(old_classify_level); } return results->size(); }