tesseract 3.04.01

training/shapeclustering.cpp File Reference

#include "base/commandlineflags.h"
#include "commontraining.h"
#include "mastertrainer.h"
#include "params.h"
#include "strngs.h"

Go to the source code of this file.

Functions

 INT_PARAM_FLAG (display_cloud_font,-1,"Display cloud of this font, canonical_class1")
 INT_PARAM_FLAG (display_canonical_font,-1,"Display canonical sample of this font, canonical_class2")
 STRING_PARAM_FLAG (canonical_class1,"","Class to show ambigs for")
 STRING_PARAM_FLAG (canonical_class2,"","Class to show ambigs for")
int main (int argc, char **argv)

Function Documentation

INT_PARAM_FLAG ( display_cloud_font  ,
1,
"Display cloud of this  font,
canonical_class1"   
)
INT_PARAM_FLAG ( display_canonical_font  ,
1,
"Display canonical sample of this  font,
canonical_class2"   
)
int main ( int  argc,
char **  argv 
)

This program reads in a text file consisting of feature samples from a training page in the following format:

      FontName UTF8-char-str xmin ymin xmax ymax page-number
       NumberOfFeatureTypes(N)
         FeatureTypeName1 NumberOfFeatures(M)
            Feature1
            ...
            FeatureM
         FeatureTypeName2 NumberOfFeatures(M)
            Feature1
            ...
            FeatureM
         ...
         FeatureTypeNameN NumberOfFeatures(M)
            Feature1
            ...
            FeatureM
      FontName CharName ...
    

The result of this program is a binary inttemp file used by the OCR engine.

Parameters:
argcnumber of command line arguments
argvarray of command line arguments
Returns:
none
Note:
Exceptions: none
History: Fri Aug 18 08:56:17 1989, DSJ, Created.
History: Mon May 18 1998, Christy Russson, Revistion started.

Definition at line 47 of file shapeclustering.cpp.

                                {
  ParseArguments(&argc, &argv);

  STRING file_prefix;
  tesseract::MasterTrainer* trainer = tesseract::LoadTrainingData(
      argc, argv, false, NULL, &file_prefix);

  if (!trainer)
    return 1;

  if (FLAGS_display_cloud_font >= 0) {
#ifndef GRAPHICS_DISABLED
    trainer->DisplaySamples(FLAGS_canonical_class1.c_str(),
                            FLAGS_display_cloud_font,
                            FLAGS_canonical_class2.c_str(),
                            FLAGS_display_canonical_font);
#endif  // GRAPHICS_DISABLED
    return 0;
  } else if (!FLAGS_canonical_class1.empty()) {
    trainer->DebugCanonical(FLAGS_canonical_class1.c_str(),
                            FLAGS_canonical_class2.c_str());
    return 0;
  }
  trainer->SetupMasterShapes();
  WriteShapeTable(file_prefix, trainer->master_shapes());
  delete trainer;

  return 0;
} /* main */
STRING_PARAM_FLAG ( canonical_class1  ,
""  ,
"Class to show ambigs for"   
)
STRING_PARAM_FLAG ( canonical_class2  ,
""  ,
"Class to show ambigs for"   
)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines