All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
adaptmatch.cpp File Reference
#include <ctype.h>
#include "shapeclassifier.h"
#include "ambigs.h"
#include "blobclass.h"
#include "blobs.h"
#include "callcpp.h"
#include "classify.h"
#include "const.h"
#include "dict.h"
#include "efio.h"
#include "emalloc.h"
#include "featdefs.h"
#include "float2int.h"
#include "genericvector.h"
#include "globals.h"
#include "helpers.h"
#include "intfx.h"
#include "intproto.h"
#include "mfoutline.h"
#include "ndminx.h"
#include "normfeat.h"
#include "normmatch.h"
#include "outfeat.h"
#include "pageres.h"
#include "params.h"
#include "picofeat.h"
#include "shapetable.h"
#include "tessclassifier.h"
#include "trainingsample.h"
#include "unicharset.h"
#include "werd.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

Go to the source code of this file.

Classes

struct  ADAPT_RESULTS
 
struct  PROTO_KEY
 

Namespaces

 tesseract
 

Macros

#define ADAPT_TEMPLATE_SUFFIX   ".a"
 
#define MAX_MATCHES   10
 
#define UNLIKELY_NUM_FEAT   200
 
#define NO_DEBUG   0
 
#define MAX_ADAPTABLE_WERD_SIZE   40
 
#define ADAPTABLE_WERD_ADJUSTMENT   (0.05)
 
#define Y_DIM_OFFSET   (Y_SHIFT - BASELINE_Y_SHIFT)
 
#define WORST_POSSIBLE_RATING   (0.0f)
 

Functions

bool MarginalMatch (float confidence, float matcher_great_threshold)
 
void InitMatcherRatings (register FLOAT32 *Rating)
 
int MakeTempProtoPerm (void *item1, void *item2)
 
void SetAdaptiveThreshold (FLOAT32 Threshold)
 

Macro Definition Documentation

#define ADAPT_TEMPLATE_SUFFIX   ".a"

Definition at line 66 of file adaptmatch.cpp.

#define ADAPTABLE_WERD_ADJUSTMENT   (0.05)

Definition at line 73 of file adaptmatch.cpp.

#define MAX_ADAPTABLE_WERD_SIZE   40

Definition at line 71 of file adaptmatch.cpp.

#define MAX_MATCHES   10

Definition at line 68 of file adaptmatch.cpp.

#define NO_DEBUG   0

Definition at line 70 of file adaptmatch.cpp.

#define UNLIKELY_NUM_FEAT   200

Definition at line 69 of file adaptmatch.cpp.

#define WORST_POSSIBLE_RATING   (0.0f)

Definition at line 77 of file adaptmatch.cpp.

#define Y_DIM_OFFSET   (Y_SHIFT - BASELINE_Y_SHIFT)

Definition at line 75 of file adaptmatch.cpp.

Function Documentation

void InitMatcherRatings ( register FLOAT32 Rating)
int MakeTempProtoPerm ( void *  item1,
void *  item2 
)

This routine converts TempProto to be permanent if its proto id is used by the configuration specified in ProtoKey.

Parameters
item1(TEMP_PROTO) temporary proto to compare to key
item2(PROTO_KEY) defines which protos to make permanent

Globals: none

Returns
TRUE if TempProto is converted, FALSE otherwise
Note
Exceptions: none
History: Thu Mar 14 18:49:54 1991, DSJ, Created.

Definition at line 2040 of file adaptmatch.cpp.

2040  {
2041  ADAPT_CLASS Class;
2043  TEMP_PROTO TempProto;
2044  PROTO_KEY *ProtoKey;
2045 
2046  TempProto = (TEMP_PROTO) item1;
2047  ProtoKey = (PROTO_KEY *) item2;
2048 
2049  Class = ProtoKey->Templates->Class[ProtoKey->ClassId];
2050  Config = TempConfigFor(Class, ProtoKey->ConfigId);
2051 
2052  if (TempProto->ProtoId > Config->MaxProtoId ||
2053  !test_bit (Config->Protos, TempProto->ProtoId))
2054  return FALSE;
2055 
2056  MakeProtoPermanent(Class, TempProto->ProtoId);
2057  AddProtoToClassPruner(&(TempProto->Proto), ProtoKey->ClassId,
2058  ProtoKey->Templates->Templates);
2059  FreeTempProto(TempProto);
2060 
2061  return TRUE;
2062 } /* MakeTempProtoPerm */
ADAPT_TEMPLATES Templates
Definition: adaptmatch.cpp:114
CLASS_ID ClassId
Definition: adaptmatch.cpp:115
uinT16 ProtoId
Definition: adaptive.h:30
void AddProtoToClassPruner(PROTO Proto, CLASS_ID ClassId, INT_TEMPLATES Templates)
Definition: intproto.cpp:346
#define test_bit(array, bit)
Definition: bitvec.h:61
ADAPT_CLASS Class[MAX_NUM_CLASSES]
Definition: adaptive.h:81
PROTO_STRUCT Proto
Definition: adaptive.h:32
#define MakeProtoPermanent(Class, ProtoId)
Definition: adaptive.h:99
#define TempConfigFor(Class, ConfigId)
Definition: adaptive.h:102
TEMP_PROTO_STRUCT * TEMP_PROTO
Definition: adaptive.h:37
INT_TEMPLATES Templates
Definition: adaptive.h:77
CLUSTERCONFIG Config
#define FALSE
Definition: capi.h:29
PROTO_ID MaxProtoId
Definition: adaptive.h:43
void FreeTempProto(void *arg)
Definition: adaptive.cpp:90
#define TRUE
Definition: capi.h:28
BIT_VECTOR Protos
Definition: adaptive.h:45
bool MarginalMatch ( float  confidence,
float  matcher_great_threshold 
)
inline

Definition at line 122 of file adaptmatch.cpp.

122  {
123  return (1.0f - confidence) > matcher_great_threshold;
124 }
void SetAdaptiveThreshold ( FLOAT32  Threshold)