tesseract  4.0.0-1-g2a2b
adaptmatch.cpp File Reference
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "adaptive.h"
#include "ambigs.h"
#include "bitvec.h"
#include "blobs.h"
#include "callcpp.h"
#include "classify.h"
#include "dict.h"
#include "errcode.h"
#include "featdefs.h"
#include "float2int.h"
#include "fontinfo.h"
#include "genericvector.h"
#include "helpers.h"
#include "host.h"
#include "intfx.h"
#include "intmatcher.h"
#include "intproto.h"
#include "matchdefs.h"
#include "mfoutline.h"
#include "normalis.h"
#include "normfeat.h"
#include "ocrfeatures.h"
#include "oldlist.h"
#include "outfeat.h"
#include "pageres.h"
#include "params.h"
#include "picofeat.h"
#include "protos.h"
#include "ratngs.h"
#include "rect.h"
#include "scrollview.h"
#include "seam.h"
#include "serialis.h"
#include "shapeclassifier.h"
#include "shapetable.h"
#include "strngs.h"
#include "tessclassifier.h"
#include "tessdatamanager.h"
#include "tprintf.h"
#include "trainingsample.h"
#include "unichar.h"
#include "unicharset.h"
#include "unicity_table.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 (float *Rating)
 
int MakeTempProtoPerm (void *item1, void *item2)
 
void SetAdaptiveThreshold (float Threshold)
 

Macro Definition Documentation

◆ ADAPT_TEMPLATE_SUFFIX

#define ADAPT_TEMPLATE_SUFFIX   ".a"

Definition at line 76 of file adaptmatch.cpp.

◆ ADAPTABLE_WERD_ADJUSTMENT

#define ADAPTABLE_WERD_ADJUSTMENT   (0.05)

Definition at line 83 of file adaptmatch.cpp.

◆ MAX_ADAPTABLE_WERD_SIZE

#define MAX_ADAPTABLE_WERD_SIZE   40

Definition at line 81 of file adaptmatch.cpp.

◆ MAX_MATCHES

#define MAX_MATCHES   10

Definition at line 78 of file adaptmatch.cpp.

◆ NO_DEBUG

#define NO_DEBUG   0

Definition at line 80 of file adaptmatch.cpp.

◆ UNLIKELY_NUM_FEAT

#define UNLIKELY_NUM_FEAT   200

Definition at line 79 of file adaptmatch.cpp.

◆ WORST_POSSIBLE_RATING

#define WORST_POSSIBLE_RATING   (0.0f)

Definition at line 87 of file adaptmatch.cpp.

◆ Y_DIM_OFFSET

#define Y_DIM_OFFSET   (Y_SHIFT - BASELINE_Y_SHIFT)

Definition at line 85 of file adaptmatch.cpp.

Function Documentation

◆ InitMatcherRatings()

void InitMatcherRatings ( float *  Rating)

◆ MakeTempProtoPerm()

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

Definition at line 1985 of file adaptmatch.cpp.

1985  {
1986  ADAPT_CLASS Class;
1988  TEMP_PROTO TempProto;
1989  PROTO_KEY *ProtoKey;
1990 
1991  TempProto = (TEMP_PROTO) item1;
1992  ProtoKey = (PROTO_KEY *) item2;
1993 
1994  Class = ProtoKey->Templates->Class[ProtoKey->ClassId];
1995  Config = TempConfigFor(Class, ProtoKey->ConfigId);
1996 
1997  if (TempProto->ProtoId > Config->MaxProtoId ||
1998  !test_bit (Config->Protos, TempProto->ProtoId))
1999  return FALSE;
2000 
2001  MakeProtoPermanent(Class, TempProto->ProtoId);
2002  AddProtoToClassPruner(&(TempProto->Proto), ProtoKey->ClassId,
2003  ProtoKey->Templates->Templates);
2004  FreeTempProto(TempProto);
2005 
2006  return TRUE;
2007 } /* MakeTempProtoPerm */
CLUSTERCONFIG Config
#define TRUE
Definition: capi.h:51
CLASS_ID ClassId
Definition: adaptmatch.cpp:125
PROTO_STRUCT Proto
Definition: adaptive.h:32
uint16_t ProtoId
Definition: adaptive.h:30
#define TempConfigFor(Class, ConfigId)
Definition: adaptive.h:101
ADAPT_CLASS Class[MAX_NUM_CLASSES]
Definition: adaptive.h:80
#define MakeProtoPermanent(Class, ProtoId)
Definition: adaptive.h:98
#define FALSE
Definition: capi.h:52
ADAPT_TEMPLATES Templates
Definition: adaptmatch.cpp:124
TEMP_PROTO_STRUCT * TEMP_PROTO
Definition: adaptive.h:37
INT_TEMPLATES Templates
Definition: adaptive.h:76
void FreeTempProto(void *arg)
Definition: adaptive.cpp:82
void AddProtoToClassPruner(PROTO Proto, CLASS_ID ClassId, INT_TEMPLATES Templates)
Definition: intproto.cpp:330
#define test_bit(array, bit)
Definition: bitvec.h:61

◆ MarginalMatch()

bool MarginalMatch ( float  confidence,
float  matcher_great_threshold 
)
inline

Definition at line 132 of file adaptmatch.cpp.

132  {
133  return (1.0f - confidence) > matcher_great_threshold;
134 }

◆ SetAdaptiveThreshold()

void SetAdaptiveThreshold ( float  Threshold)