Tesseract 3.01
/data/source/tesseract-ocr/textord/oldbasel.cpp File Reference
#include "mfcpch.h"
#include "ccstruct.h"
#include "statistc.h"
#include "quadlsq.h"
#include "detlinefit.h"
#include "makerow.h"
#include "drawtord.h"
#include "oldbasel.h"
#include "textord.h"
#include "tprintf.h"

Namespaces

namespace  tesseract

Defines

#define EXTERN
#define TURNLIMIT   1
#define X_HEIGHT_FRACTION   0.7
#define DESCENDER_FRACTION   0.5
#define MIN_ASC_FRACTION   0.20
#define MIN_DESC_FRACTION   0.25
#define MINASCRISE   2.0
#define MAXHEIGHTVARIANCE   0.15
#define MAXHEIGHT   300
#define MAXOVERLAP   0.1
#define MAXBADRUN   2
#define HEIGHTBUCKETS   200
#define DELTAHEIGHT   5.0
#define GOODHEIGHT   5
#define MAXLOOPS   10
#define MODENUM   10
#define MAXPARTS   6
#define SPLINESIZE   23
#define ABS(x)   ((x)<0 ? (-(x)) : (x))

Functions

int get_blob_coords (TO_ROW *row, inT32 lineheight, TBOX *blobcoords, BOOL8 &holed_line, int &outcount)
void make_first_baseline (TBOX blobcoords[], int blobcount, int xcoords[], int ycoords[], QSPLINE *spline, QSPLINE *baseline, float jumplimit)
void make_holed_baseline (TBOX blobcoords[], int blobcount, QSPLINE *spline, QSPLINE *baseline, float gradient)
int partition_line (TBOX blobcoords[], int blobcount, int *numparts, char partids[], int partsizes[], QSPLINE *spline, float jumplimit, float ydiffs[])
void merge_oldbl_parts (TBOX blobcoords[], int blobcount, char partids[], int partsizes[], int biggestpart, float jumplimit)
int get_ydiffs (TBOX blobcoords[], int blobcount, QSPLINE *spline, float ydiffs[])
int choose_partition (register float diff, float partdiffs[], int lastpart, float jumplimit, float *drift, float *lastdelta, int *partcount)
int partition_coords (TBOX blobcoords[], int blobcount, char partids[], int bestpart, int xcoords[], int ycoords[])
 *merge_partitions(partids,partcount,blobcount,bestpart) discards funny looking
int segment_spline (TBOX blobcoords[], int blobcount, int xcoords[], int ycoords[], int degree, int pointcount, int xstarts[])
BOOL8 split_stepped_spline (QSPLINE *baseline, float jumplimit, int xcoords[], int xstarts[], int &segments)
void insert_spline_point (int xstarts[], int segment, int coord1, int coord2, int &segments)
void find_lesser_parts (TO_ROW *row, TBOX blobcoords[], int blobcount, char partids[], int partsizes[], int partcount, int bestpart)
void old_first_xheight (TO_ROW *row, TBOX blobcoords[], int initialheight, int blobcount, QSPLINE *baseline, float jumplimit)
void make_first_xheight (TO_ROW *row, TBOX blobcoords[], int lineheight, int init_lineheight, int blobcount, QSPLINE *baseline, float jumplimit)
void find_top_modes (STATS *stats, int statnum, int modelist[], int modenum)
void pick_x_height (TO_ROW *row, int modelist[], int lefts[], int rights[], STATS *heightstat, int mode_threshold)

Variables

EXTERN bool textord_really_old_xheight = 0
EXTERN bool textord_oldbl_debug = 0
EXTERN bool textord_debug_baselines = 0
EXTERN bool textord_oldbl_paradef = 1
EXTERN bool textord_oldbl_split_splines = 1
EXTERN bool textord_oldbl_merge_parts = 1
EXTERN bool oldbl_corrfix = 1
EXTERN bool oldbl_xhfix = 0
EXTERN bool textord_ocropus_mode = 0
EXTERN double oldbl_xhfract = 0.4
EXTERN int oldbl_holed_losscount = 10
EXTERN double oldbl_dot_error_size = 1.26
EXTERN double textord_oldbl_jumplimit = 0.15
const int kMinModeFactorOcropus = 32
const int kMinModeFactor = 12

Define Documentation

#define ABS (   x)    ((x)<0 ? (-(x)) : (x))
#define DELTAHEIGHT   5.0
#define DESCENDER_FRACTION   0.5
#define EXTERN
#define GOODHEIGHT   5
#define HEIGHTBUCKETS   200
#define MAXBADRUN   2
#define MAXHEIGHT   300
#define MAXHEIGHTVARIANCE   0.15
#define MAXLOOPS   10
#define MAXOVERLAP   0.1
#define MAXPARTS   6
#define MIN_ASC_FRACTION   0.20
#define MIN_DESC_FRACTION   0.25
#define MINASCRISE   2.0
#define MODENUM   10
#define SPLINESIZE   23
#define TURNLIMIT   1
#define X_HEIGHT_FRACTION   0.7

Function Documentation

int choose_partition ( register float  diff,
float  partdiffs[],
int  lastpart,
float  jumplimit,
float *  drift,
float *  lastdelta,
int *  partcount 
)
void find_lesser_parts ( TO_ROW row,
TBOX  blobcoords[],
int  blobcount,
char  partids[],
int  partsizes[],
int  partcount,
int  bestpart 
)
void find_top_modes ( STATS stats,
int  statnum,
int  modelist[],
int  modenum 
)
int get_blob_coords ( TO_ROW row,
inT32  lineheight,
TBOX blobcoords,
BOOL8 holed_line,
int &  outcount 
)
int get_ydiffs ( TBOX  blobcoords[],
int  blobcount,
QSPLINE spline,
float  ydiffs[] 
)
void insert_spline_point ( int  xstarts[],
int  segment,
int  coord1,
int  coord2,
int &  segments 
)
void make_first_baseline ( TBOX  blobcoords[],
int  blobcount,
int  xcoords[],
int  ycoords[],
QSPLINE spline,
QSPLINE baseline,
float  jumplimit 
)
void make_first_xheight ( TO_ROW row,
TBOX  blobcoords[],
int  lineheight,
int  init_lineheight,
int  blobcount,
QSPLINE baseline,
float  jumplimit 
)
void make_holed_baseline ( TBOX  blobcoords[],
int  blobcount,
QSPLINE spline,
QSPLINE baseline,
float  gradient 
)
void merge_oldbl_parts ( TBOX  blobcoords[],
int  blobcount,
char  partids[],
int  partsizes[],
int  biggestpart,
float  jumplimit 
)
void old_first_xheight ( TO_ROW row,
TBOX  blobcoords[],
int  initialheight,
int  blobcount,
QSPLINE baseline,
float  jumplimit 
)
int partition_coords ( TBOX  blobcoords[],
int  blobcount,
char  partids[],
int  bestpart,
int  xcoords[],
int  ycoords[] 
)

*merge_partitions(partids,partcount,blobcount,bestpart) discards funny looking

int partition_line ( TBOX  blobcoords[],
int  blobcount,
int *  numparts,
char  partids[],
int  partsizes[],
QSPLINE spline,
float  jumplimit,
float  ydiffs[] 
)
void pick_x_height ( TO_ROW row,
int  modelist[],
int  lefts[],
int  rights[],
STATS heightstat,
int  mode_threshold 
)
int segment_spline ( TBOX  blobcoords[],
int  blobcount,
int  xcoords[],
int  ycoords[],
int  degree,
int  pointcount,
int  xstarts[] 
)
BOOL8 split_stepped_spline ( QSPLINE baseline,
float  jumplimit,
int  xcoords[],
int  xstarts[],
int &  segments 
)

Variable Documentation

const int kMinModeFactor = 12
const int kMinModeFactorOcropus = 32
EXTERN bool oldbl_corrfix = 1

"Improve correlation of heights"

EXTERN double oldbl_dot_error_size = 1.26

"Max aspect ratio of a dot"

EXTERN int oldbl_holed_losscount = 10

"Max lost before fallback line used"

EXTERN bool oldbl_xhfix = 0

"Fix bug in modes threshold for xheights"

EXTERN double oldbl_xhfract = 0.4

"Fraction of est allowed in calc"

EXTERN bool textord_debug_baselines = 0

"Debug baseline generation"

EXTERN bool textord_ocropus_mode = 0

"Make baselines for ocropus"

EXTERN bool textord_oldbl_debug = 0

"Debug old baseline generation"

EXTERN double textord_oldbl_jumplimit = 0.15

"X fraction for new partition"

EXTERN bool textord_oldbl_merge_parts = 1

"Merge suspect partitions"

EXTERN bool textord_oldbl_paradef = 1

"Use para default mechanism"

EXTERN bool textord_oldbl_split_splines = 1

"Split stepped splines"

EXTERN bool textord_really_old_xheight = 0

"Use original wiseowl xheight"

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines