tesseract
3.04.00
|
#include <math.h>
#include <stdio.h>
#include <assert.h>
#include "classify.h"
#include "const.h"
#include "emalloc.h"
#include "fontinfo.h"
#include "genericvector.h"
#include "globals.h"
#include "helpers.h"
#include "intproto.h"
#include "mfoutline.h"
#include "ndminx.h"
#include "picofeat.h"
#include "points.h"
#include "shapetable.h"
#include "svmnode.h"
Go to the source code of this file.
Classes | |
struct | FILL_SWITCH |
struct | TABLE_FILLER |
struct | FILL_SPEC |
Namespaces | |
tesseract | |
Macros | |
#define | PROTO_PRUNER_SCALE (4.0) |
#define | INT_DESCENDER (0.0 * INT_CHAR_NORM_RANGE) |
#define | INT_BASELINE (0.25 * INT_CHAR_NORM_RANGE) |
#define | INT_XHEIGHT (0.75 * INT_CHAR_NORM_RANGE) |
#define | INT_CAPHEIGHT (1.0 * INT_CHAR_NORM_RANGE) |
#define | INT_XCENTER (0.5 * INT_CHAR_NORM_RANGE) |
#define | INT_YCENTER (0.5 * INT_CHAR_NORM_RANGE) |
#define | INT_XRADIUS (0.2 * INT_CHAR_NORM_RANGE) |
#define | INT_YRADIUS (0.2 * INT_CHAR_NORM_RANGE) |
#define | INT_MIN_X 0 |
#define | INT_MIN_Y 0 |
#define | INT_MAX_X INT_CHAR_NORM_RANGE |
#define | INT_MAX_Y INT_CHAR_NORM_RANGE |
#define | HV_TOLERANCE (0.0025) /* approx 0.9 degrees */ |
#define | MAX_NUM_SWITCHES 3 |
#define | OLD_MAX_NUM_CONFIGS 32 |
#define | OLD_WERDS_PER_CONFIG_VEC |
#define | CircularIncrement(i, r) (((i) < (r) - 1)?((i)++):((i) = 0)) |
#define | MapParam(P, O, N) (floor (((P) + (O)) * (N))) |
#define | MAX_LEVEL 2 |
#define | XS X_SHIFT |
#define | YS Y_SHIFT |
#define | AS ANGLE_SHIFT |
#define | NB NUM_CP_BUCKETS |
Enumerations | |
enum | SWITCH_TYPE { StartSwitch, EndSwitch, LastSwitch } |
Variables | |
ScrollView * | IntMatchWindow = NULL |
ScrollView * | FeatureDisplayWindow = NULL |
ScrollView * | ProtoDisplayWindow = NULL |
int | classify_num_cp_levels = 3 |
double | classify_cp_angle_pad_loose = 45.0 |
double | classify_cp_angle_pad_medium = 20.0 |
double | classify_cp_angle_pad_tight = 10.0 |
double | classify_cp_end_pad_loose = 0.5 |
double | classify_cp_end_pad_medium = 0.5 |
double | classify_cp_end_pad_tight = 0.5 |
double | classify_cp_side_pad_loose = 2.5 |
double | classify_cp_side_pad_medium = 1.2 |
double | classify_cp_side_pad_tight = 0.6 |
double | classify_pp_angle_pad = 45.0 |
double | classify_pp_end_pad = 0.5 |
double | classify_pp_side_pad = 2.5 |
#define AS ANGLE_SHIFT |
#define CircularIncrement | ( | i, | |
r | |||
) | (((i) < (r) - 1)?((i)++):((i) = 0)) |
macro for performing circular increments of bucket indices
Definition at line 122 of file intproto.cpp.
#define HV_TOLERANCE (0.0025) /* approx 0.9 degrees */ |
define pad used to snap near horiz/vertical protos to horiz/vertical
Definition at line 71 of file intproto.cpp.
#define INT_BASELINE (0.25 * INT_CHAR_NORM_RANGE) |
Definition at line 57 of file intproto.cpp.
#define INT_CAPHEIGHT (1.0 * INT_CHAR_NORM_RANGE) |
Definition at line 59 of file intproto.cpp.
#define INT_DESCENDER (0.0 * INT_CHAR_NORM_RANGE) |
Definition at line 56 of file intproto.cpp.
#define INT_MAX_X INT_CHAR_NORM_RANGE |
Definition at line 67 of file intproto.cpp.
#define INT_MAX_Y INT_CHAR_NORM_RANGE |
Definition at line 68 of file intproto.cpp.
#define INT_MIN_X 0 |
Definition at line 65 of file intproto.cpp.
#define INT_MIN_Y 0 |
Definition at line 66 of file intproto.cpp.
#define INT_XCENTER (0.5 * INT_CHAR_NORM_RANGE) |
Definition at line 61 of file intproto.cpp.
#define INT_XHEIGHT (0.75 * INT_CHAR_NORM_RANGE) |
Definition at line 58 of file intproto.cpp.
#define INT_XRADIUS (0.2 * INT_CHAR_NORM_RANGE) |
Definition at line 63 of file intproto.cpp.
#define INT_YCENTER (0.5 * INT_CHAR_NORM_RANGE) |
Definition at line 62 of file intproto.cpp.
#define INT_YRADIUS (0.2 * INT_CHAR_NORM_RANGE) |
Definition at line 64 of file intproto.cpp.
#define MapParam | ( | P, | |
O, | |||
N | |||
) | (floor (((P) + (O)) * (N))) |
macro for mapping floats to ints without bounds checking
Definition at line 125 of file intproto.cpp.
#define MAX_LEVEL 2 |
#define MAX_NUM_SWITCHES 3 |
Definition at line 76 of file intproto.cpp.
#define NB NUM_CP_BUCKETS |
#define OLD_MAX_NUM_CONFIGS 32 |
Definition at line 114 of file intproto.cpp.
#define OLD_WERDS_PER_CONFIG_VEC |
Definition at line 115 of file intproto.cpp.
#define PROTO_PRUNER_SCALE (4.0) |
Definition at line 54 of file intproto.cpp.
#define XS X_SHIFT |
#define YS Y_SHIFT |
enum SWITCH_TYPE |
Enumerator | |
---|---|
StartSwitch | |
EndSwitch | |
LastSwitch |
Definition at line 73 of file intproto.cpp.
void AddIntClass | ( | INT_TEMPLATES | Templates, |
CLASS_ID | ClassId, | ||
INT_CLASS | Class | ||
) |
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
Definition at line 241 of file intproto.cpp.
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
Definition at line 274 of file intproto.cpp.
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
Definition at line 298 of file intproto.cpp.
void AddProtoToClassPruner | ( | PROTO | Proto, |
CLASS_ID | ClassId, | ||
INT_TEMPLATES | Templates | ||
) |
Definition at line 337 of file intproto.cpp.
Definition at line 381 of file intproto.cpp.
Definition at line 449 of file intproto.cpp.
Definition at line 445 of file intproto.cpp.
Definition at line 1244 of file intproto.cpp.
Definition at line 1223 of file intproto.cpp.
Definition at line 458 of file intproto.cpp.
void ConvertConfig | ( | BIT_VECTOR | Config, |
int | ConfigId, | ||
INT_CLASS | Class | ||
) |
Definition at line 484 of file intproto.cpp.
ScrollView* CreateFeatureSpaceWindow | ( | const char * | name, |
int | xpos, | ||
int | ypos | ||
) |
Definition at line 1976 of file intproto.cpp.
void DisplayIntFeature | ( | const INT_FEATURE_STRUCT * | Feature, |
FLOAT32 | Evidence | ||
) |
Definition at line 628 of file intproto.cpp.
Definition at line 650 of file intproto.cpp.
void DoFill | ( | FILL_SPEC * | FillSpec, |
CLASS_PRUNER_STRUCT * | Pruner, | ||
register uinT32 | ClassMask, | ||
register uinT32 | ClassCount, | ||
register uinT32 | WordIndex | ||
) |
Definition at line 1264 of file intproto.cpp.
BOOL8 FillerDone | ( | TABLE_FILLER * | Filler | ) |
Definition at line 1314 of file intproto.cpp.
void FillPPCircularBits | ( | uinT32 | ParamTable[NUM_PP_BUCKETS][WERDS_PER_PP_VECTOR], |
int | Bit, | ||
FLOAT32 | Center, | ||
FLOAT32 | Spread, | ||
bool | debug | ||
) |
Definition at line 1338 of file intproto.cpp.
void FillPPLinearBits | ( | uinT32 | ParamTable[NUM_PP_BUCKETS][WERDS_PER_PP_VECTOR], |
int | Bit, | ||
FLOAT32 | Center, | ||
FLOAT32 | Spread, | ||
bool | debug | ||
) |
Definition at line 1382 of file intproto.cpp.
void free_int_class | ( | INT_CLASS | int_class | ) |
Definition at line 725 of file intproto.cpp.
void free_int_templates | ( | INT_TEMPLATES | templates | ) |
Definition at line 764 of file intproto.cpp.
Definition at line 1498 of file intproto.cpp.
ScrollView::Color GetMatchColorFor | ( | FLOAT32 | Evidence | ) |
Definition at line 1550 of file intproto.cpp.
void GetNextFill | ( | TABLE_FILLER * | Filler, |
FILL_SPEC * | Fill | ||
) |
Definition at line 1576 of file intproto.cpp.
void InitFeatureDisplayWindowIfReqd | ( | ) |
Initializes the feature display window if it is not already initialized.
Definition at line 1967 of file intproto.cpp.
void InitIntMatchWindowIfReqd | ( | ) |
Initializes the int matcher window if it is not already initialized.
Definition at line 1935 of file intproto.cpp.
void InitProtoDisplayWindowIfReqd | ( | ) |
Initializes the proto display window if it is not already initialized.
Definition at line 1956 of file intproto.cpp.
void InitTableFiller | ( | FLOAT32 | EndPad, |
FLOAT32 | SidePad, | ||
FLOAT32 | AnglePad, | ||
PROTO | Proto, | ||
TABLE_FILLER * | Filler | ||
) |
This routine computes a data structure (Filler) which can be used to fill in a rectangle surrounding the specified Proto.
EndPad,SidePad,AnglePad | padding to add to proto |
Proto | proto to create a filler for |
Filler | place to put table filler |
Globals: none
Definition at line 1644 of file intproto.cpp.
INT_CLASS NewIntClass | ( | int | MaxNumProtos, |
int | MaxNumConfigs | ||
) |
Definition at line 673 of file intproto.cpp.
INT_TEMPLATES NewIntTemplates | ( | ) |
Definition at line 739 of file intproto.cpp.
void RenderIntFeature | ( | ScrollView * | window, |
const INT_FEATURE_STRUCT * | Feature, | ||
ScrollView::Color | color | ||
) |
Definition at line 1808 of file intproto.cpp.
void RenderIntProto | ( | ScrollView * | window, |
INT_CLASS | Class, | ||
PROTO_ID | ProtoId, | ||
ScrollView::Color | color | ||
) |
Definition at line 1845 of file intproto.cpp.
int TruncateParam | ( | FLOAT32 | Param, |
int | Min, | ||
int | Max, | ||
char * | Id | ||
) |
This routine truncates Param to lie within the range of Min-Max inclusive. If a truncation is performed, and Id is not null, an warning message is printed.
Param | parameter value to be truncated |
Min,Max | parameter limits (inclusive) |
Id | string id of parameter for error messages |
Globals: none
Definition at line 1913 of file intproto.cpp.
void UpdateMatchDisplay | ( | ) |
Definition at line 466 of file intproto.cpp.
double classify_cp_angle_pad_loose = 45.0 |
"Class Pruner Angle Pad Loose"
Definition at line 192 of file intproto.cpp.
double classify_cp_angle_pad_medium = 20.0 |
"Class Pruner Angle Pad Medium"
Definition at line 194 of file intproto.cpp.
double classify_cp_angle_pad_tight = 10.0 |
"CLass Pruner Angle Pad Tight"
Definition at line 196 of file intproto.cpp.
double classify_cp_end_pad_loose = 0.5 |
"Class Pruner End Pad Loose"
Definition at line 197 of file intproto.cpp.
double classify_cp_end_pad_medium = 0.5 |
"Class Pruner End Pad Medium"
Definition at line 198 of file intproto.cpp.
double classify_cp_end_pad_tight = 0.5 |
"Class Pruner End Pad Tight"
Definition at line 199 of file intproto.cpp.
double classify_cp_side_pad_loose = 2.5 |
"Class Pruner Side Pad Loose"
Definition at line 200 of file intproto.cpp.
double classify_cp_side_pad_medium = 1.2 |
"Class Pruner Side Pad Medium"
Definition at line 201 of file intproto.cpp.
double classify_cp_side_pad_tight = 0.6 |
"Class Pruner Side Pad Tight"
Definition at line 202 of file intproto.cpp.
int classify_num_cp_levels = 3 |
"Number of Class Pruner Levels"
Definition at line 190 of file intproto.cpp.
double classify_pp_angle_pad = 45.0 |
"Proto Pruner Angle Pad"
Definition at line 203 of file intproto.cpp.
double classify_pp_end_pad = 0.5 |
"Proto Prune End Pad"
Definition at line 204 of file intproto.cpp.
double classify_pp_side_pad = 2.5 |
"Proto Pruner Side Pad"
Definition at line 205 of file intproto.cpp.
ScrollView* FeatureDisplayWindow = NULL |
Definition at line 182 of file intproto.cpp.
ScrollView* IntMatchWindow = NULL |
Definition at line 181 of file intproto.cpp.
ScrollView* ProtoDisplayWindow = NULL |
Definition at line 183 of file intproto.cpp.