#include "genericvector.h"
#include "matchdefs.h"
#include "mfoutline.h"
#include "protos.h"
#include "scrollview.h"
#include "unicharset.h"
Go to the source code of this file.
Classes | |
struct | CLASS_PRUNER_STRUCT |
struct | INT_PROTO_STRUCT |
struct | PROTO_SET_STRUCT |
struct | INT_CLASS_STRUCT |
struct | INT_TEMPLATES_STRUCT |
struct | INT_FEATURE_STRUCT |
Namespaces | |
namespace | tesseract |
Defines | |
#define | PRUNER_X 0 |
#define | PRUNER_Y 1 |
#define | PRUNER_ANGLE 2 |
#define | ANGLE_SHIFT (0.0) |
#define | X_SHIFT (0.5) |
#define | Y_SHIFT (0.5) |
#define | MAX_PROTO_INDEX 24 |
#define | BITS_PER_WERD (8 * sizeof (uinT32)) |
#define | MAX_NUM_CONFIGS 64 |
#define | MAX_NUM_PROTOS 512 |
#define | PROTOS_PER_PROTO_SET 64 |
#define | MAX_NUM_PROTO_SETS (MAX_NUM_PROTOS / PROTOS_PER_PROTO_SET) |
#define | NUM_PP_PARAMS 3 |
#define | NUM_PP_BUCKETS 64 |
#define | NUM_CP_BUCKETS 24 |
#define | CLASSES_PER_CP 32 |
#define | NUM_BITS_PER_CLASS 2 |
#define | CLASS_PRUNER_CLASS_MASK (~(~0 << NUM_BITS_PER_CLASS)) |
#define | CLASSES_PER_CP_WERD (CLASSES_PER_CP / NUM_BITS_PER_CLASS) |
#define | PROTOS_PER_PP_WERD BITS_PER_WERD |
#define | BITS_PER_CP_VECTOR (CLASSES_PER_CP * NUM_BITS_PER_CLASS) |
#define | MAX_NUM_CLASS_PRUNERS |
#define | WERDS_PER_CP_VECTOR (BITS_PER_CP_VECTOR / BITS_PER_WERD) |
#define | WERDS_PER_PP_VECTOR |
#define | WERDS_PER_PP |
#define | WERDS_PER_CP |
#define | WERDS_PER_CONFIG_VEC |
#define | MAX_NUM_INT_FEATURES 512 |
#define | INT_CHAR_NORM_RANGE 256 |
#define | MaxNumIntProtosIn(C) (C->NumProtoSets * PROTOS_PER_PROTO_SET) |
#define | SetForProto(P) (P / PROTOS_PER_PROTO_SET) |
#define | IndexForProto(P) (P % PROTOS_PER_PROTO_SET) |
#define | ProtoForProtoId(C, P) |
#define | PPrunerWordIndexFor(I) |
#define | PPrunerBitIndexFor(I) ((I) % PROTOS_PER_PP_WERD) |
#define | PPrunerMaskFor(I) (1 << PPrunerBitIndexFor (I)) |
#define | MaxNumClassesIn(T) (T->NumClassPruners * CLASSES_PER_CP) |
#define | LegalClassId(c) ((c) >= 0 && (c) <= MAX_CLASS_ID) |
#define | UnusedClassIdIn(T, c) ((T)->Class[c] == NULL) |
#define | ClassForClassId(T, c) ((T)->Class[c]) |
#define | ClassPrunersFor(T) ((T)->ClassPruner) |
#define | CPrunerIdFor(c) ((c) / CLASSES_PER_CP) |
#define | CPrunerFor(T, c) ((T)->ClassPruners[CPrunerIdFor(c)]) |
#define | CPrunerWordIndexFor(c) (((c) % CLASSES_PER_CP) / CLASSES_PER_CP_WERD) |
#define | CPrunerBitIndexFor(c) (((c) % CLASSES_PER_CP) % CLASSES_PER_CP_WERD) |
#define | CPrunerMaskFor(L, c) (((L)+1) << CPrunerBitIndexFor (c) * NUM_BITS_PER_CLASS) |
#define | PRINT_MATCH_SUMMARY 0x001 |
#define | DISPLAY_FEATURE_MATCHES 0x002 |
#define | DISPLAY_PROTO_MATCHES 0x004 |
#define | PRINT_FEATURE_MATCHES 0x008 |
#define | PRINT_PROTO_MATCHES 0x010 |
#define | CLIP_MATCH_EVIDENCE 0x020 |
#define | MatchDebuggingOn(D) (D) |
#define | PrintMatchSummaryOn(D) ((D) & PRINT_MATCH_SUMMARY) |
#define | DisplayFeatureMatchesOn(D) ((D) & DISPLAY_FEATURE_MATCHES) |
#define | DisplayProtoMatchesOn(D) ((D) & DISPLAY_PROTO_MATCHES) |
#define | PrintFeatureMatchesOn(D) ((D) & PRINT_FEATURE_MATCHES) |
#define | PrintProtoMatchesOn(D) ((D) & PRINT_PROTO_MATCHES) |
#define | ClipMatchEvidenceOn(D) ((D) & CLIP_MATCH_EVIDENCE) |
Typedefs | |
typedef struct INT_PROTO_STRUCT * | INT_PROTO |
typedef uinT32 | PROTO_PRUNER [NUM_PP_PARAMS][NUM_PP_BUCKETS][WERDS_PER_PP_VECTOR] |
typedef struct PROTO_SET_STRUCT * | PROTO_SET |
typedef uinT32 | CONFIG_PRUNER [NUM_PP_PARAMS][NUM_PP_BUCKETS][4] |
typedef struct INT_CLASS_STRUCT * | INT_CLASS |
typedef struct INT_TEMPLATES_STRUCT * | INT_TEMPLATES |
typedef INT_FEATURE_STRUCT * | INT_FEATURE |
typedef INT_FEATURE_STRUCT | INT_FEATURE_ARRAY [MAX_NUM_INT_FEATURES] |
Enumerations | |
enum | IntmatcherDebugAction { IDA_ADAPTIVE, IDA_STATIC, IDA_SHAPE_INDEX, IDA_BOTH } |
Functions | |
void | AddIntClass (INT_TEMPLATES Templates, CLASS_ID ClassId, INT_CLASS Class) |
int | AddIntConfig (INT_CLASS Class) |
int | AddIntProto (INT_CLASS Class) |
void | AddProtoToClassPruner (PROTO Proto, CLASS_ID ClassId, INT_TEMPLATES Templates) |
void | AddProtoToProtoPruner (PROTO Proto, int ProtoId, INT_CLASS Class, bool debug) |
int | BucketFor (FLOAT32 Param, FLOAT32 Offset, int NumBuckets) |
int | CircBucketFor (FLOAT32 Param, FLOAT32 Offset, int NumBuckets) |
void | UpdateMatchDisplay () |
void | ConvertConfig (BIT_VECTOR Config, int ConfigId, INT_CLASS Class) |
void | DisplayIntFeature (const INT_FEATURE_STRUCT *Feature, FLOAT32 Evidence) |
void | DisplayIntProto (INT_CLASS Class, PROTO_ID ProtoId, FLOAT32 Evidence) |
INT_CLASS | NewIntClass (int MaxNumProtos, int MaxNumConfigs) |
INT_TEMPLATES | NewIntTemplates () |
void | free_int_templates (INT_TEMPLATES templates) |
void | ShowMatchDisplay () |
void | tesseract::ClearFeatureSpaceWindow (NORM_METHOD norm_method, ScrollView *window) |
void | RenderIntFeature (ScrollView *window, const INT_FEATURE_STRUCT *Feature, ScrollView::Color color) |
void | InitIntMatchWindowIfReqd () |
void | InitProtoDisplayWindowIfReqd () |
void | InitFeatureDisplayWindowIfReqd () |
ScrollView * | CreateFeatureSpaceWindow (const char *name, int xpos, int ypos) |
#define ANGLE_SHIFT (0.0) |
#define BITS_PER_CP_VECTOR (CLASSES_PER_CP * NUM_BITS_PER_CLASS) |
#define BITS_PER_WERD (8 * sizeof (uinT32)) |
#define CLASS_PRUNER_CLASS_MASK (~(~0 << NUM_BITS_PER_CLASS)) |
#define CLASSES_PER_CP 32 |
#define CLASSES_PER_CP_WERD (CLASSES_PER_CP / NUM_BITS_PER_CLASS) |
#define ClassForClassId | ( | T, | |||
c | ) | ((T)->Class[c]) |
#define ClassPrunersFor | ( | T | ) | ((T)->ClassPruner) |
#define CLIP_MATCH_EVIDENCE 0x020 |
#define ClipMatchEvidenceOn | ( | D | ) | ((D) & CLIP_MATCH_EVIDENCE) |
#define CPrunerBitIndexFor | ( | c | ) | (((c) % CLASSES_PER_CP) % CLASSES_PER_CP_WERD) |
#define CPrunerFor | ( | T, | |||
c | ) | ((T)->ClassPruners[CPrunerIdFor(c)]) |
#define CPrunerIdFor | ( | c | ) | ((c) / CLASSES_PER_CP) |
#define CPrunerMaskFor | ( | L, | |||
c | ) | (((L)+1) << CPrunerBitIndexFor (c) * NUM_BITS_PER_CLASS) |
#define CPrunerWordIndexFor | ( | c | ) | (((c) % CLASSES_PER_CP) / CLASSES_PER_CP_WERD) |
#define DISPLAY_FEATURE_MATCHES 0x002 |
#define DISPLAY_PROTO_MATCHES 0x004 |
#define DisplayFeatureMatchesOn | ( | D | ) | ((D) & DISPLAY_FEATURE_MATCHES) |
#define DisplayProtoMatchesOn | ( | D | ) | ((D) & DISPLAY_PROTO_MATCHES) |
#define IndexForProto | ( | P | ) | (P % PROTOS_PER_PROTO_SET) |
#define INT_CHAR_NORM_RANGE 256 |
#define LegalClassId | ( | c | ) | ((c) >= 0 && (c) <= MAX_CLASS_ID) |
#define MatchDebuggingOn | ( | D | ) | (D) |
#define MAX_NUM_CLASS_PRUNERS |
((MAX_NUM_CLASSES + CLASSES_PER_CP - 1) / \ CLASSES_PER_CP)
#define MAX_NUM_CONFIGS 64 |
#define MAX_NUM_INT_FEATURES 512 |
#define MAX_NUM_PROTO_SETS (MAX_NUM_PROTOS / PROTOS_PER_PROTO_SET) |
#define MAX_NUM_PROTOS 512 |
#define MAX_PROTO_INDEX 24 |
#define MaxNumClassesIn | ( | T | ) | (T->NumClassPruners * CLASSES_PER_CP) |
#define MaxNumIntProtosIn | ( | C | ) | (C->NumProtoSets * PROTOS_PER_PROTO_SET) |
---------------------------------------------------------------------------- Macros ----------------------------------------------------------------------------
#define NUM_BITS_PER_CLASS 2 |
#define NUM_CP_BUCKETS 24 |
#define NUM_PP_BUCKETS 64 |
#define NUM_PP_PARAMS 3 |
#define PPrunerBitIndexFor | ( | I | ) | ((I) % PROTOS_PER_PP_WERD) |
#define PPrunerMaskFor | ( | I | ) | (1 << PPrunerBitIndexFor (I)) |
#define PPrunerWordIndexFor | ( | I | ) |
(((I) % PROTOS_PER_PROTO_SET) / \ PROTOS_PER_PP_WERD)
#define PRINT_FEATURE_MATCHES 0x008 |
#define PRINT_MATCH_SUMMARY 0x001 |
#define PRINT_PROTO_MATCHES 0x010 |
#define PrintFeatureMatchesOn | ( | D | ) | ((D) & PRINT_FEATURE_MATCHES) |
#define PrintMatchSummaryOn | ( | D | ) | ((D) & PRINT_MATCH_SUMMARY) |
#define PrintProtoMatchesOn | ( | D | ) | ((D) & PRINT_PROTO_MATCHES) |
#define ProtoForProtoId | ( | C, | |||
P | ) |
(&((C->ProtoSets[SetForProto (P)])-> \ Protos [IndexForProto (P)]))
#define PROTOS_PER_PP_WERD BITS_PER_WERD |
#define PROTOS_PER_PROTO_SET 64 |
#define PRUNER_ANGLE 2 |
#define PRUNER_X 0 |
---------------------------------------------------------------------------- Include Files and Type Defines ----------------------------------------------------------------------------
#define PRUNER_Y 1 |
#define SetForProto | ( | P | ) | (P / PROTOS_PER_PROTO_SET) |
#define UnusedClassIdIn | ( | T, | |||
c | ) | ((T)->Class[c] == NULL) |
#define WERDS_PER_CONFIG_VEC |
((MAX_NUM_CONFIGS + BITS_PER_WERD - 1) / \ BITS_PER_WERD)
#define WERDS_PER_CP |
#define WERDS_PER_CP_VECTOR (BITS_PER_CP_VECTOR / BITS_PER_WERD) |
#define WERDS_PER_PP |
#define WERDS_PER_PP_VECTOR |
#define X_SHIFT (0.5) |
#define Y_SHIFT (0.5) |
typedef uinT32 CONFIG_PRUNER[NUM_PP_PARAMS][NUM_PP_BUCKETS][4] |
typedef struct INT_CLASS_STRUCT * INT_CLASS |
typedef INT_FEATURE_STRUCT* INT_FEATURE |
typedef INT_FEATURE_STRUCT INT_FEATURE_ARRAY[MAX_NUM_INT_FEATURES] |
typedef struct INT_PROTO_STRUCT * INT_PROTO |
typedef struct INT_TEMPLATES_STRUCT * INT_TEMPLATES |
typedef uinT32 PROTO_PRUNER[NUM_PP_PARAMS][NUM_PP_BUCKETS][WERDS_PER_PP_VECTOR] |
typedef struct PROTO_SET_STRUCT * PROTO_SET |
void AddIntClass | ( | INT_TEMPLATES | Templates, | |
CLASS_ID | ClassId, | |||
INT_CLASS | Class | |||
) |
---------------------------------------------------------------------------- Public Function Prototypes ----------------------------------------------------------------------------
This routine adds a new class structure to a set of templates. Classes have to be added to Templates in the order of increasing ClassIds.
Templates | templates to add new class to | |
ClassId | class id to associate new class with | |
Class | class data structure to add to templates |
Globals: none
int AddIntConfig | ( | INT_CLASS | Class | ) |
This routine returns the index of the next free config in Class.
Class | class to add new configuration to |
Globals: none
int AddIntProto | ( | INT_CLASS | Class | ) |
This routine allocates the next free proto in Class and returns its index.
Class | class to add new proto to |
Globals: none
void AddProtoToClassPruner | ( | PROTO | Proto, | |
CLASS_ID | ClassId, | |||
INT_TEMPLATES | Templates | |||
) |
void ConvertConfig | ( | BIT_VECTOR | Config, | |
int | ConfigId, | |||
INT_CLASS | Class | |||
) |
ScrollView* CreateFeatureSpaceWindow | ( | const char * | name, | |
int | xpos, | |||
int | ypos | |||
) |
void DisplayIntFeature | ( | const INT_FEATURE_STRUCT * | Feature, | |
FLOAT32 | Evidence | |||
) |
void free_int_templates | ( | INT_TEMPLATES | templates | ) |
void InitFeatureDisplayWindowIfReqd | ( | ) |
Initializes the feature display window if it is not already initialized.
void InitIntMatchWindowIfReqd | ( | ) |
Initializes the int matcher window if it is not already initialized.
void InitProtoDisplayWindowIfReqd | ( | ) |
Initializes the proto display window if it is not already initialized.
INT_CLASS NewIntClass | ( | int | MaxNumProtos, | |
int | MaxNumConfigs | |||
) |
INT_TEMPLATES NewIntTemplates | ( | ) |
void RenderIntFeature | ( | ScrollView * | window, | |
const INT_FEATURE_STRUCT * | Feature, | |||
ScrollView::Color | color | |||
) |
void ShowMatchDisplay | ( | ) |
void UpdateMatchDisplay | ( | ) |