5 /* ----------------------------------------------------------------
6 - functions with thousand of lines make the compilation very slow
7 therefore the ocr0-function is splitted in subfunctions
8 - shared data used often in ocr0-subroutines are stored
9 in ocr0_shared structure.
10 * ------------------------------------------------------------ */
12 typedef struct ocr0_shared { /* shared variables and properties */
14 struct box *box1; /* box in whole image */
15 pix *bp; /* extracted temporarly box, cleaned */
16 int cs; /* global threshold value (gray level) */
18 /* ToDo: or MACROS: X0 = box1->x0 */
19 int x0, x1, y0, y1; /* box coordinates related to box1 */
20 int dx, dy; /* size of box */
21 int hchar, gchar; /* relation to m1..m4 */
22 int aa[4][4]; /* corner points, see xX (x,y,dist^2,vector_idx) v0.41 */
23 holes_t holes; /* list of holes (max MAX_HOLES) */
27 /* tests for umlaut */
28 int testumlaut(struct box *box1, int cs, int m, wchar_t *modifier);
30 wchar_t ocr0(struct box *box1, pix *b, int cs);
32 wchar_t ocr0n(ocr0_shared_t *sdata);
34 static inline int sq(int x) { return x*x; } /* square */
37 * go from vector j1 to vector j2 and measure maximum deviation of
38 * the steps from the line connecting j1 and j2
39 * return the squared maximum distance
40 * in units of the box size times 1024
42 int line_deviation( struct box *box1, int j1, int j2 );
45 * search vectors between j1 and j2 for nearest point a to point r
48 * r-> $$...$$ $ - mark vectors
49 * @@$..@@ @ - black pixels
50 * @@$..@@ . - white pixels
56 * j1 --> $$...$$ <-- j2
58 * ToDo: vector aa[5] = {rx,ry,x,y,d^2,idx} statt rx,ry?
59 * j1 and j2 must be in the same frame
62 int nearest_frame_vector( struct box *box1, int j1, int j2, int rx, int ry);