tesseract  3.03
tesseract::TessClassifier Class Reference

#include <tessclassifier.h>

Inheritance diagram for tesseract::TessClassifier:
tesseract::ShapeClassifier

List of all members.

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 ShapeTableGetShapeTable () const
virtual const UNICHARSETGetUnicharset () const
virtual int DisplayClassifyAs (const TrainingSample &sample, Pix *page_pix, int unichar_id, int index, PointerVector< ScrollView > *windows)

Detailed Description

Definition at line 36 of file tessclassifier.h.


Constructor & Destructor Documentation

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.

{}

Member Function Documentation

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;
}

Implements tesseract::ShapeClassifier.

Definition at line 54 of file tessclassifier.cpp.

                                                      {
  return classify_->shape_table();
}

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();
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines