tesseract v5.3.3.20231005
shapeclustering.cpp File Reference
#include "commontraining.h"
#include "mastertrainer.h"
#include "params.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 44 of file shapeclustering.cpp.

44 {
45 tesseract::CheckSharedLibraryVersion();
46
47 ParseArguments(&argc, &argv);
48
49 std::string file_prefix;
50 auto trainer = tesseract::LoadTrainingData(argv + 1, false, nullptr, file_prefix);
51
52 if (!trainer) {
53 return EXIT_FAILURE;
54 }
55
56 if (FLAGS_display_cloud_font >= 0) {
57#ifndef GRAPHICS_DISABLED
58 trainer->DisplaySamples(FLAGS_canonical_class1.c_str(), FLAGS_display_cloud_font,
59 FLAGS_canonical_class2.c_str(), FLAGS_display_canonical_font);
60#endif // !GRAPHICS_DISABLED
61 return EXIT_SUCCESS;
62 } else if (!FLAGS_canonical_class1.empty()) {
63 trainer->DebugCanonical(FLAGS_canonical_class1.c_str(), FLAGS_canonical_class2.c_str());
64 return EXIT_SUCCESS;
65 }
66 trainer->SetupMasterShapes();
67 WriteShapeTable(file_prefix, trainer->master_shapes());
68
69 return EXIT_SUCCESS;
70} /* main */
void WriteShapeTable(const std::string &file_prefix, const ShapeTable &shape_table)
void ParseArguments(int *argc, char ***argv)
std::unique_ptr< MasterTrainer > LoadTrainingData(const char *const *filelist, bool replication, ShapeTable **shape_table, std::string &file_prefix)