#include <cmath>
#include <cstring>
#include <cstdio>
#include "classify.h"
#include "cluster.h"
#include "clusttool.h"
#include "commontraining.h"
#include "featdefs.h"
#include "fontinfo.h"
#include "genericvector.h"
#include "indexmapbidi.h"
#include "intproto.h"
#include "mastertrainer.h"
#include "mergenf.h"
#include "mf.h"
#include "ocrfeatures.h"
#include "oldlist.h"
#include "protos.h"
#include "shapetable.h"
#include "tessopt.h"
#include "tprintf.h"
#include "unicity_table.h"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
◆ _USE_MATH_DEFINES
#define _USE_MATH_DEFINES |
◆ main()
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
-
argc | number of command line arguments |
argv | array of command line arguments |
- Returns
- 0 if no error occurred
Definition at line 209 of file mftraining.cpp.
210 tesseract::CheckSharedLibraryVersion();
221 if (trainer ==
nullptr)
return 1;
228 SetupConfigMap(shape_table, &config_map);
240 unicharset = &shape_set;
244 for (
int s = 0; s < num_shapes; ++s) {
252 int num_configs = shape_table->
NumShapes();
254 for (
int s = 0; s < num_configs; ++s) {
255 int unichar_id, font_id;
256 if (unicharset == &shape_set) {
263 const char* class_label = unicharset->
id_to_unichar(unichar_id);
264 mf_classes = ClusterOneConfig(s, class_label, mf_classes, *shape_table,
267 STRING inttemp_file = file_prefix;
268 inttemp_file +=
"inttemp";
269 STRING pffmtable_file = file_prefix;
270 pffmtable_file +=
"pffmtable";
274 *shape_table, float_classes,
277 for (
int c = 0; c < unicharset->
size(); ++c) {
280 delete [] float_classes;
285 if (!FLAGS_test_ch.empty()) {
287 printf(
"Hit return to exit...\n");
288 while (getchar() !=
'\n');
◆ kMaxShapeLabelLength
const int kMaxShapeLabelLength = 10 |