tesseract  4.0.0-1-g2a2b
shapeclustering.cpp File Reference
#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() [1/2]

INT_PARAM_FLAG ( display_cloud_font  ,
1,
"Display cloud of this  font,
canonical_class1"   
)

◆ INT_PARAM_FLAG() [2/2]

INT_PARAM_FLAG ( display_canonical_font  ,
1,
"Display canonical sample of this  font,
canonical_class2"   
)

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 47 of file shapeclustering.cpp.

47  {
48  tesseract::CheckSharedLibraryVersion();
49 
50  ParseArguments(&argc, &argv);
51 
52  STRING file_prefix;
53  tesseract::MasterTrainer* trainer =
54  tesseract::LoadTrainingData(argc, argv, false, nullptr, &file_prefix);
55 
56  if (!trainer)
57  return 1;
58 
59  if (FLAGS_display_cloud_font >= 0) {
60 #ifndef GRAPHICS_DISABLED
61  trainer->DisplaySamples(FLAGS_canonical_class1.c_str(),
62  FLAGS_display_cloud_font,
63  FLAGS_canonical_class2.c_str(),
64  FLAGS_display_canonical_font);
65 #endif // GRAPHICS_DISABLED
66  return 0;
67  } else if (!FLAGS_canonical_class1.empty()) {
68  trainer->DebugCanonical(FLAGS_canonical_class1.c_str(),
69  FLAGS_canonical_class2.c_str());
70  return 0;
71  }
72  trainer->SetupMasterShapes();
73  WriteShapeTable(file_prefix, trainer->master_shapes());
74  delete trainer;
75 
76  return 0;
77 } /* main */
void DisplaySamples(const char *unichar_str1, int cloud_font, const char *unichar_str2, int canonical_font)
void ParseArguments(int *argc, char ***argv)
void DebugCanonical(const char *unichar_str1, const char *unichar_str2)
void WriteShapeTable(const STRING &file_prefix, const ShapeTable &shape_table)
const ShapeTable & master_shapes() const
Definition: strngs.h:45
MasterTrainer * LoadTrainingData(int argc, const char *const *argv, bool replication, ShapeTable **shape_table, STRING *file_prefix)

◆ STRING_PARAM_FLAG() [1/2]

STRING_PARAM_FLAG ( canonical_class1  ,
""  ,
"Class to show ambigs for"   
)

◆ STRING_PARAM_FLAG() [2/2]

STRING_PARAM_FLAG ( canonical_class2  ,
""  ,
"Class to show ambigs for"   
)