tesseract  3.05.02
tesseract::CharClassifierFactory Class Reference

#include <classifier_factory.h>

Static Public Member Functions

static CharClassifierCreate (const string &data_file_path, const string &lang, LangModel *lang_mod, CharSet *char_set, TuningParams *params)
 

Detailed Description

Definition at line 31 of file classifier_factory.h.

Member Function Documentation

◆ Create()

CharClassifier * tesseract::CharClassifierFactory::Create ( const string &  data_file_path,
const string &  lang,
LangModel lang_mod,
CharSet char_set,
TuningParams params 
)
static

Definition at line 35 of file classifier_factory.cpp.

39  {
40  // create the feature extraction object
41  FeatureBase *feat_extract;
42 
43  switch (params->TypeFeature()) {
44  case TuningParams::BMP:
45  feat_extract = new FeatureBmp(params);
46  break;
48  feat_extract = new FeatureChebyshev(params);
49  break;
51  feat_extract = new FeatureHybrid(params);
52  break;
53  default:
54  fprintf(stderr, "Cube ERROR (CharClassifierFactory::Create): invalid "
55  "feature type.\n");
56  return NULL;
57  }
58 
59  // create the classifier object
60  CharClassifier *classifier_obj;
61  switch (params->TypeClassifier()) {
62  case TuningParams::NN:
63  classifier_obj = new ConvNetCharClassifier(char_set, params,
64  feat_extract);
65  break;
67  classifier_obj = new HybridNeuralNetCharClassifier(char_set, params,
68  feat_extract);
69  break;
70  default:
71  fprintf(stderr, "Cube ERROR (CharClassifierFactory::Create): invalid "
72  "classifier type.\n");
73  return NULL;
74  }
75 
76  // Init the classifier
77  if (!classifier_obj->Init(data_file_path, lang, lang_mod)) {
78  delete classifier_obj;
79  fprintf(stderr, "Cube ERROR (CharClassifierFactory::Create): unable "
80  "to Init() character classifier object.\n");
81  return NULL;
82  }
83  return classifier_obj;
84 }

The documentation for this class was generated from the following files: