127 tprintf(
"YMiddle: Proto=%g, Delta=%g, Var=%g, Dist=%g\n",
134 tprintf(
"Height: Proto=%g, Delta=%g, Var=%g, Dist=%g\n",
141 tprintf(
"Width: Proto=%g, Delta=%g, Var=%g\n",
149 tprintf(
"Total Dist=%g, scaled=%g, sigmoid=%g, penalty=%g\n",
154 if (Match < BestMatch)
188 NormAdj = NormAdj * NormAdj * NormAdj;
190 NormAdj = NormAdj * NormAdj;
193 return (1.0 / (1.0 + NormAdj));
217 for (i = 0, TotalMatch = 0.0; i < NumParams; i++) {
218 ParamMatch = (Feature->
Params[i] -
Mean(Proto, i)) /
221 fprintf (File,
" %6.1f", ParamMatch);
224 TotalMatch += ParamMatch * ParamMatch;
226 fprintf (File,
" --> %6.1f (%4.2f)\n",
265 while ((end_offset < 0 || ftell(
File) < end_offset) &&
266 tfscanf(
File,
"%s %d", unichar, &NumProtos) == 2) {
270 for (i = 0; i < NumProtos; i++)
275 cprintf(
"Error: unichar %s in normproto file is not in unichar set.\n",
277 for (i = 0; i < NumProtos; i++)
void cprintf(const char *format,...)
FLOAT32 Mean(PROTOTYPE *Proto, uinT16 Dimension)
PROTOTYPE * ReadPrototype(FILE *File, uinT16 N)
const double kWidthErrorWeighting
bool TESS_API contains_unichar(const char *const unichar_repr) const
double classify_norm_adj_midpoint
int tfscanf(FILE *stream, const char *format,...)
NORM_PROTOS * ReadNormProtos(FILE *File, inT64 end_offset)
LIST push_last(LIST list, void *item)
FLOAT32 StandardDeviation(PROTOTYPE *Proto, uinT16 Dimension)
FLOAT32 ComputeNormMatch(CLASS_ID ClassId, const FEATURE_STRUCT &feature, BOOL8 DebugMatch)
void FreePrototype(void *arg)
UNICHAR_ID TESS_API unichar_to_id(const char *const unichar_repr) const
PARAM_DESC * ReadParamDesc(FILE *File, uinT16 N)
double NormEvidenceOf(register double NormAdj)
uinT16 ReadSampleSize(FILE *File)
NORM_PROTOS * ReadNormProtos(FILE *File)
double classify_norm_adj_curl
#define double_VAR(name, val, comment)
const char * id_to_unichar(UNICHAR_ID id) const
void SkipNewline(FILE *file)
void FreeProtoList(LIST *ProtoList)
void PrintNormMatch(FILE *File, int NumParams, PROTOTYPE *Proto, FEATURE Feature)