Tesseract  3.02
tesseract-ocr/classify/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

namespace  tesseract

Functions

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

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)

---------------------------------------------------------------------------- Private Function Prototypes ----------------------------------------------------------------------------

---------------------------------------------------------------------------- Private Code ----------------------------------------------------------------------------

Definition at line 179 of file normmatch.cpp.

                                               {
  NormAdj /= classify_norm_adj_midpoint;

  if (classify_norm_adj_curl == 3)
    NormAdj = NormAdj * NormAdj * NormAdj;
  else if (classify_norm_adj_curl == 2)
    NormAdj = NormAdj * NormAdj;
  else
    NormAdj = pow (NormAdj, classify_norm_adj_curl);
  return (1.0 / (1.0 + NormAdj));
}
void PrintNormMatch ( FILE *  File,
int  NumParams,
PROTOTYPE Proto,
FEATURE  Feature 
)

Definition at line 193 of file normmatch.cpp.

                                     {
/*
 **     Parameters:
 **             File            open 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
 **     Operation: This routine dumps out detailed normalization match info.
 **     Return: none
 **     Exceptions: none
 **     History: Wed Jan  2 09:49:35 1991, DSJ, Created.
 */
  int i;
  FLOAT32 ParamMatch;
  FLOAT32 TotalMatch;

  for (i = 0, TotalMatch = 0.0; i < NumParams; i++) {
    ParamMatch = (Feature->Params[i] - Mean(Proto, i)) /
      StandardDeviation(Proto, i);

    fprintf (File, " %6.1f", ParamMatch);

    if (i == CharNormY || i == CharNormRx)
      TotalMatch += ParamMatch * ParamMatch;
  }
  fprintf (File, " --> %6.1f (%4.2f)\n",
    TotalMatch, NormEvidenceOf (TotalMatch));

}                                /* PrintNormMatch */
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.

---------------------------------------------------------------------------- Variables ---------------------------------------------------------------------------- "Norm adjust midpoint ..."

Definition at line 63 of file normmatch.cpp.

const double kWidthErrorWeighting = 0.125

Definition at line 66 of file normmatch.cpp.