tesseract 3.04.01

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

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.

                                               {
  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 
)

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.

                                     {
  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.

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.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines