tesseract v5.3.3.20231005
intproto.cpp File Reference
#include "intproto.h"
#include "classify.h"
#include "fontinfo.h"
#include "mfoutline.h"
#include "picofeat.h"
#include "points.h"
#include "shapetable.h"
#include "svmnode.h"
#include "helpers.h"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>

Go to the source code of this file.

Classes

struct  tesseract::FILL_SWITCH
 
struct  tesseract::TABLE_FILLER
 
struct  tesseract::FILL_SPEC
 

Namespaces

namespace  tesseract
 

Macros

#define _USE_MATH_DEFINES
 
#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   ((OLD_MAX_NUM_CONFIGS + BITS_PER_WERD - 1) / BITS_PER_WERD)
 
#define CircularIncrement(i, r)   (((i) < (r)-1) ? ((i)++) : ((i) = 0))
 
#define MapParam(P, O, N)   (std::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  tesseract::SWITCH_TYPE { tesseract::StartSwitch , tesseract::EndSwitch , tesseract::LastSwitch }
 

Functions

float tesseract::BucketStart (int Bucket, float Offset, int NumBuckets)
 
float tesseract::BucketEnd (int Bucket, float Offset, int NumBuckets)
 
void tesseract::DoFill (FILL_SPEC *FillSpec, CLASS_PRUNER_STRUCT *Pruner, uint32_t ClassMask, uint32_t ClassCount, uint32_t WordIndex)
 
bool tesseract::FillerDone (TABLE_FILLER *Filler)
 
void tesseract::FillPPCircularBits (uint32_t ParamTable[NUM_PP_BUCKETS][WERDS_PER_PP_VECTOR], int Bit, float Center, float Spread, bool debug)
 
void tesseract::FillPPLinearBits (uint32_t ParamTable[NUM_PP_BUCKETS][WERDS_PER_PP_VECTOR], int Bit, float Center, float Spread, bool debug)
 
void tesseract::GetCPPadsForLevel (int Level, float *EndPad, float *SidePad, float *AnglePad)
 
ScrollView::Color tesseract::GetMatchColorFor (float Evidence)
 
void tesseract::GetNextFill (TABLE_FILLER *Filler, FILL_SPEC *Fill)
 
void tesseract::InitTableFiller (float EndPad, float SidePad, float AnglePad, PROTO_STRUCT *Proto, TABLE_FILLER *Filler)
 
void tesseract::RenderIntFeature (ScrollView *window, const INT_FEATURE_STRUCT *Feature, ScrollView::Color color)
 
void tesseract::RenderIntProto (ScrollView *window, INT_CLASS_STRUCT *Class, PROTO_ID ProtoId, ScrollView::Color color)
 
void tesseract::AddIntClass (INT_TEMPLATES_STRUCT *Templates, CLASS_ID ClassId, INT_CLASS_STRUCT *Class)
 
int tesseract::AddIntConfig (INT_CLASS_STRUCT *Class)
 
int tesseract::AddIntProto (INT_CLASS_STRUCT *Class)
 
void tesseract::AddProtoToClassPruner (PROTO_STRUCT *Proto, CLASS_ID ClassId, INT_TEMPLATES_STRUCT *Templates)
 
void tesseract::AddProtoToProtoPruner (PROTO_STRUCT *Proto, int ProtoId, INT_CLASS_STRUCT *Class, bool debug)
 
uint8_t tesseract::Bucket8For (float param, float offset, int num_buckets)
 
uint16_t tesseract::Bucket16For (float param, float offset, int num_buckets)
 
uint8_t tesseract::CircBucketFor (float param, float offset, int num_buckets)
 
void tesseract::UpdateMatchDisplay ()
 
void tesseract::ConvertConfig (BIT_VECTOR Config, int ConfigId, INT_CLASS_STRUCT *Class)
 
void tesseract::DisplayIntFeature (const INT_FEATURE_STRUCT *Feature, float Evidence)
 
void tesseract::DisplayIntProto (INT_CLASS_STRUCT *Class, PROTO_ID ProtoId, float Evidence)
 
void tesseract::ClearFeatureSpaceWindow (NORM_METHOD norm_method, ScrollView *window)
 
void tesseract::InitIntMatchWindowIfReqd ()
 
void tesseract::InitProtoDisplayWindowIfReqd ()
 
void tesseract::InitFeatureDisplayWindowIfReqd ()
 
ScrollView * tesseract::CreateFeatureSpaceWindow (const char *name, int xpos, int ypos)
 

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Definition at line 21 of file intproto.cpp.

◆ AS

#define AS   ANGLE_SHIFT

◆ CircularIncrement

#define CircularIncrement (   i,
 
)    (((i) < (r)-1) ? ((i)++) : ((i) = 0))

macro for performing circular increments of bucket indices

Definition at line 102 of file intproto.cpp.

◆ HV_TOLERANCE

#define HV_TOLERANCE   (0.0025) /* approx 0.9 degrees */

define pad used to snap near horiz/vertical protos to horiz/vertical

Definition at line 67 of file intproto.cpp.

◆ INT_BASELINE

#define INT_BASELINE   (0.25 * INT_CHAR_NORM_RANGE)

Definition at line 53 of file intproto.cpp.

◆ INT_CAPHEIGHT

#define INT_CAPHEIGHT   (1.0 * INT_CHAR_NORM_RANGE)

Definition at line 55 of file intproto.cpp.

◆ INT_DESCENDER

#define INT_DESCENDER   (0.0 * INT_CHAR_NORM_RANGE)

Definition at line 52 of file intproto.cpp.

◆ INT_MAX_X

#define INT_MAX_X   INT_CHAR_NORM_RANGE

Definition at line 63 of file intproto.cpp.

◆ INT_MAX_Y

#define INT_MAX_Y   INT_CHAR_NORM_RANGE

Definition at line 64 of file intproto.cpp.

◆ INT_MIN_X

#define INT_MIN_X   0

Definition at line 61 of file intproto.cpp.

◆ INT_MIN_Y

#define INT_MIN_Y   0

Definition at line 62 of file intproto.cpp.

◆ INT_XCENTER

#define INT_XCENTER   (0.5 * INT_CHAR_NORM_RANGE)

Definition at line 57 of file intproto.cpp.

◆ INT_XHEIGHT

#define INT_XHEIGHT   (0.75 * INT_CHAR_NORM_RANGE)

Definition at line 54 of file intproto.cpp.

◆ INT_XRADIUS

#define INT_XRADIUS   (0.2 * INT_CHAR_NORM_RANGE)

Definition at line 59 of file intproto.cpp.

◆ INT_YCENTER

#define INT_YCENTER   (0.5 * INT_CHAR_NORM_RANGE)

Definition at line 58 of file intproto.cpp.

◆ INT_YRADIUS

#define INT_YRADIUS   (0.2 * INT_CHAR_NORM_RANGE)

Definition at line 60 of file intproto.cpp.

◆ MapParam

#define MapParam (   P,
  O,
 
)    (std::floor(((P) + (O)) * (N)))

macro for mapping floats to ints without bounds checking

Definition at line 105 of file intproto.cpp.

◆ MAX_LEVEL

#define MAX_LEVEL   2

◆ MAX_NUM_SWITCHES

#define MAX_NUM_SWITCHES   3

Definition at line 70 of file intproto.cpp.

◆ NB

#define NB   NUM_CP_BUCKETS

◆ OLD_MAX_NUM_CONFIGS

#define OLD_MAX_NUM_CONFIGS   32

Definition at line 95 of file intproto.cpp.

◆ OLD_WERDS_PER_CONFIG_VEC

#define OLD_WERDS_PER_CONFIG_VEC   ((OLD_MAX_NUM_CONFIGS + BITS_PER_WERD - 1) / BITS_PER_WERD)

Definition at line 96 of file intproto.cpp.

◆ PROTO_PRUNER_SCALE

#define PROTO_PRUNER_SCALE   (4.0)

Definition at line 50 of file intproto.cpp.

◆ XS

#define XS   X_SHIFT

◆ YS

#define YS   Y_SHIFT