All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
normmatch.cpp File Reference
#include "normmatch.h"
#include <stdio.h>
#include <math.h>
#include "classify.h"
#include "clusttool.h"
#include "const.h"
#include "efio.h"
#include "emalloc.h"
#include "globals.h"
#include "helpers.h"
#include "normfeat.h"
#include "scanutils.h"
#include "unicharset.h"
#include "params.h"

Go to the source code of this file.

Classes

struct  NORM_PROTOS
 

Namespaces

 tesseract
 

Functions

NORM_PROTOSReadNormProtos (FILE *File)
 
NormEvidenceOf

Return the new type of evidence number corresponding to this normalization adjustment. The equation that represents the transform is: 1 / (1 + (NormAdj / midpoint) ^ curl)

double NormEvidenceOf (register double NormAdj)
 
void PrintNormMatch (FILE *File, int NumParams, PROTOTYPE *Proto, FEATURE Feature)
 

Variables

double classify_norm_adj_midpoint = 32.0
 
double classify_norm_adj_curl = 2.0
 
const double kWidthErrorWeighting = 0.125
 

Function Documentation

double NormEvidenceOf ( register double  NormAdj)

Definition at line 184 of file normmatch.cpp.

184  {
185  NormAdj /= classify_norm_adj_midpoint;
186 
187  if (classify_norm_adj_curl == 3)
188  NormAdj = NormAdj * NormAdj * NormAdj;
189  else if (classify_norm_adj_curl == 2)
190  NormAdj = NormAdj * NormAdj;
191  else
192  NormAdj = pow (NormAdj, classify_norm_adj_curl);
193  return (1.0 / (1.0 + NormAdj));
194 }
double classify_norm_adj_midpoint
Definition: normmatch.cpp:63
double classify_norm_adj_curl
Definition: normmatch.cpp:64
void PrintNormMatch ( FILE *  File,
int  NumParams,
PROTOTYPE Proto,
FEATURE  Feature 
)

This routine dumps out detailed normalization match info.

Parameters
Fileopen text file to dump match debug info to
NumParams# of parameters in proto and feature
Proto[]array of prototype parameters
Feature[]array of feature parameters Globals: none
Returns
none
Note
Exceptions: none
History: Wed Jan 2 09:49:35 1991, DSJ, Created.

Definition at line 209 of file normmatch.cpp.

212  {
213  int i;
214  FLOAT32 ParamMatch;
215  FLOAT32 TotalMatch;
216 
217  for (i = 0, TotalMatch = 0.0; i < NumParams; i++) {
218  ParamMatch = (Feature->Params[i] - Mean(Proto, i)) /
219  StandardDeviation(Proto, i);
220 
221  fprintf (File, " %6.1f", ParamMatch);
222 
223  if (i == CharNormY || i == CharNormRx)
224  TotalMatch += ParamMatch * ParamMatch;
225  }
226  fprintf (File, " --> %6.1f (%4.2f)\n",
227  TotalMatch, NormEvidenceOf (TotalMatch));
228 
229 } /* PrintNormMatch */
float FLOAT32
Definition: host.h:111
FLOAT32 Params[1]
Definition: ocrfeatures.h:65
FLOAT32 Mean(PROTOTYPE *Proto, uinT16 Dimension)
Definition: cluster.cpp:650
double NormEvidenceOf(register double NormAdj)
Definition: normmatch.cpp:184
FLOAT32 StandardDeviation(PROTOTYPE *Proto, uinT16 Dimension)
Definition: cluster.cpp:664
NORM_PROTOS* ReadNormProtos ( FILE *  File)

Variable Documentation

double classify_norm_adj_curl = 2.0

"Norm adjust curl ..."

Definition at line 64 of file normmatch.cpp.

double classify_norm_adj_midpoint = 32.0

control knobs used to control the normalization adjustment process "Norm adjust midpoint ..."

Definition at line 63 of file normmatch.cpp.

const double kWidthErrorWeighting = 0.125

Weight of width variance against height and vertical position.

Definition at line 66 of file normmatch.cpp.