00001 00018 #ifndef TESSCLAS_H 00019 #define TESSCLAS_H 1 00020 00022 #define SPLINESIZE 23 00023 00024 #define TBLOBFLAGS 4 00025 00026 #define MAX_WO_CLASSES 3 00027 00028 #define EDGEPTFLAGS 4 00029 00049 typedef struct 00050 { 00052 double a; 00054 double b; 00056 double c; 00057 } QUAD_SPEC; 00058 00063 typedef struct 00064 { 00066 int segments; 00068 int xstarts[SPLINESIZE]; 00070 QUAD_SPEC quads[SPLINESIZE]; 00071 } SPLINE_SPEC; 00072 00077 typedef struct 00078 { 00080 short x; 00082 short y; 00083 } TPOINT; 00084 00089 typedef TPOINT VECTOR; 00090 00095 typedef struct 00096 { 00098 char dx; 00100 char dy; 00101 } BYTEVEC; 00102 00111 typedef struct edgeptstruct 00112 { 00114 TPOINT pos; 00116 VECTOR vec; 00118 char flags[EDGEPTFLAGS]; 00120 struct edgeptstruct *next; 00122 struct edgeptstruct *prev; 00123 } EDGEPT; 00124 00133 typedef struct blobstruct 00134 { 00136 struct olinestruct *outlines; 00138 char flags[TBLOBFLAGS]; 00140 char correct; 00142 char guess; 00144 unsigned char classes[MAX_WO_CLASSES]; 00146 unsigned char values[MAX_WO_CLASSES]; 00148 struct blobstruct *next; 00149 } TBLOB; 00150 00159 typedef struct olinestruct 00160 { 00162 TPOINT topleft; 00164 TPOINT botright; 00166 TPOINT start; 00168 BYTEVEC *compactloop; 00170 EDGEPT *loop; 00172 void *node; 00174 struct olinestruct *next; 00176 struct olinestruct *child; 00177 } TESSLINE; 00178 00187 typedef struct wordstruct 00188 { 00190 struct textrowstruct *row; 00192 char *correct; 00194 char *guess; 00196 TBLOB *blobs; 00198 int blanks; 00200 int blobcount; 00202 struct wordstruct *next; 00203 } TWERD; 00204 00213 typedef struct textrowstruct 00214 { 00216 int blobcount; 00218 TBLOB *blobs; 00220 TWERD *words; 00222 int mean_y; 00224 int max_y; 00226 int min_y; 00228 SPLINE_SPEC xheight; 00230 SPLINE_SPEC baseline; 00232 float descdrop; 00234 float ascrise; 00236 float lineheight; 00238 int kerning; 00240 int space; 00242 float space_threshold; 00244 int p_spaced; 00246 int b_space; 00248 int b_kern; 00250 struct textrowstruct *next; 00251 } TEXTROW; 00252 00261 typedef struct blockstruct 00262 { 00264 TBLOB *blobs; 00266 TEXTROW *rows; 00268 int blobcount; 00270 short xmin; 00272 short xmax; 00274 short ymin; 00276 short ymax; 00278 char type; 00280 char p_spaced; 00282 short rowcount; 00284 short leading; 00286 short kerning; 00288 short space; 00290 short minwidth; 00292 short p_size; 00294 short l_margin; 00296 short italic; 00298 short spurious; 00300 struct blockstruct *next; 00301 } TEXTBLOCK; 00302 00306 #define iterate_blobs(blob,blobs) \ 00307 for (blob = blobs; blob != NULL; blob = blob->next) 00308 #endif