tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
30 static const char kUnknownFontName[] =
"UnknownFont";
32 static STRING_VAR(classify_font_name, kUnknownFontName,
33 "Default font name to be used in training");
46 *fontname = classify_font_name;
47 if (*fontname == kUnknownFontName) {
50 const char *basename = strrchr(filename.
c_str(),
'/');
51 const char *firstdot = strchr(basename ? basename : filename.
c_str(),
'.');
52 const char *lastdot = strrchr(filename.
c_str(),
'.');
53 if (firstdot != lastdot && firstdot !=
nullptr && lastdot !=
nullptr) {
73 const char* blob_text) {
82 tr_file_data_ +=
"\n";
83 tr_file_data_ += fontname;
85 tr_file_data_ += blob_text;
86 tr_file_data_ +=
"\n";
91 tprintf(
"Blob learned was invalid!\n");
100 STRING tr_filename = filename +
".tr";
101 FILE* fp = fopen(tr_filename.
c_str(),
"wb");
FEATURE_SET ExtractMicros(TBLOB *Blob, const DENORM &cn_denorm)
FEATURE_SET FeatureSets[NUM_FEATURE_TYPES]
void truncate_at(int32_t index)
#define STRING_VAR(name, val, comment)
FEATURE_SET ExtractIntGeoFeatures(const TBLOB &blob, const INT_FX_RESULT_STRUCT &fx_info)
void ExtractFontName(const STRING &filename, STRING *fontname)
void WriteCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc, STRING *str)
const char * c_str() const
FEATURE_DEFS_STRUCT feature_defs_
FEATURE_SET ExtractIntCNFeatures(const TBLOB &blob, const INT_FX_RESULT_STRUCT &fx_info)
bool WriteTRFile(const STRING &filename)
FEATURE_SET ExtractCharNormFeatures(const INT_FX_RESULT_STRUCT &fx_info)
void LearnBlob(const STRING &fontname, TBLOB *Blob, const DENORM &cn_denorm, const INT_FX_RESULT_STRUCT &fx_info, const char *blob_text)
DLLSYM void tprintf(const char *format,...)
bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, CHAR_DESC CharDesc)
CHAR_DESC NewCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs)
bool Serialize(FILE *fp, const char *data, size_t n=1)
void FreeCharDescription(CHAR_DESC CharDesc)