tesseract v5.3.3.20231005
oldbasel.cpp File Reference
#include "oldbasel.h"
#include "ccstruct.h"
#include "detlinefit.h"
#include "drawtord.h"
#include "makerow.h"
#include "quadlsq.h"
#include "statistc.h"
#include "textord.h"
#include "tprintf.h"
#include <cmath>
#include <vector>
#include <algorithm>

Go to the source code of this file.

Namespaces

namespace  tesseract
 

Macros

#define TURNLIMIT   1 /*min size for turning point */
 
#define X_HEIGHT_FRACTION   0.7 /*x-height/caps height */
 
#define DESCENDER_FRACTION   0.5 /*descender/x-height */
 
#define MIN_ASC_FRACTION   0.20 /*min size of ascenders */
 
#define MIN_DESC_FRACTION   0.25 /*min size of descenders */
 
#define MINASCRISE   2.0 /*min ascender/desc step */
 
#define MAXHEIGHTVARIANCE   0.15 /*accepted variation in x-height */
 
#define MAXHEIGHT   300 /*max blob height */
 
#define MAXOVERLAP   0.1 /*max 10% missed overlap */
 
#define MAXBADRUN   2 /*max non best for failed */
 
#define HEIGHTBUCKETS   200 /* Num of buckets */
 
#define MODENUM   10
 
#define MAXPARTS   6
 
#define SPLINESIZE   23
 
#define ABS(x)   ((x) < 0 ? (-(x)) : (x))
 

Functions

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

Variables

bool tesseract::textord_oldbl_debug = false
 
const int tesseract::kMinModeFactorOcropus = 32
 
const int tesseract::kMinModeFactor = 12
 

Macro Definition Documentation

◆ ABS

#define ABS (   x)    ((x) < 0 ? (-(x)) : (x))

Definition at line 71 of file oldbasel.cpp.

◆ DESCENDER_FRACTION

#define DESCENDER_FRACTION   0.5 /*descender/x-height */

Definition at line 58 of file oldbasel.cpp.

◆ HEIGHTBUCKETS

#define HEIGHTBUCKETS   200 /* Num of buckets */

Definition at line 66 of file oldbasel.cpp.

◆ MAXBADRUN

#define MAXBADRUN   2 /*max non best for failed */

Definition at line 65 of file oldbasel.cpp.

◆ MAXHEIGHT

#define MAXHEIGHT   300 /*max blob height */

Definition at line 63 of file oldbasel.cpp.

◆ MAXHEIGHTVARIANCE

#define MAXHEIGHTVARIANCE   0.15 /*accepted variation in x-height */

Definition at line 62 of file oldbasel.cpp.

◆ MAXOVERLAP

#define MAXOVERLAP   0.1 /*max 10% missed overlap */

Definition at line 64 of file oldbasel.cpp.

◆ MAXPARTS

#define MAXPARTS   6

Definition at line 68 of file oldbasel.cpp.

◆ MIN_ASC_FRACTION

#define MIN_ASC_FRACTION   0.20 /*min size of ascenders */

Definition at line 59 of file oldbasel.cpp.

◆ MIN_DESC_FRACTION

#define MIN_DESC_FRACTION   0.25 /*min size of descenders */

Definition at line 60 of file oldbasel.cpp.

◆ MINASCRISE

#define MINASCRISE   2.0 /*min ascender/desc step */

Definition at line 61 of file oldbasel.cpp.

◆ MODENUM

#define MODENUM   10

Definition at line 67 of file oldbasel.cpp.

◆ SPLINESIZE

#define SPLINESIZE   23

Definition at line 69 of file oldbasel.cpp.

◆ TURNLIMIT

#define TURNLIMIT   1 /*min size for turning point */

Definition at line 56 of file oldbasel.cpp.

◆ X_HEIGHT_FRACTION

#define X_HEIGHT_FRACTION   0.7 /*x-height/caps height */

Definition at line 57 of file oldbasel.cpp.