~ubuntu-branches/ubuntu/lucid/swftools/lucid

« back to all changes in this revision

Viewing changes to lib/gocr/ocr0.h

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2009-04-30 05:22:19 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090430052219-l1n64qofzeq5pej8
Tags: 0.9.0-0ubuntu1
* New upstream release (LP: #369931)
  - patches/01_manpages: edited to match updated version of src/pdf2swf.1 and
    src/wav2swf.1
  - patches/02_faq: edited to match updated version of FAQ
  - patches/04_makefile: edited to delete the patch on lib/Makefile.in and 
    src/Makefile.in (applied upstream)
  - deleted patch 99_configure_for_python2.5_and_2.6 (applied upstream)
  - debian/swftools.doc: deleted installation of TODO and 
    pdf2swf/HOWTO_pdf2swf as they don't exist anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _OCR0_H
 
2
#define _OCR0_H
 
3
#include "pgm2asc.h"
 
4
 
 
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
 *  ------------------------------------------------------------  */
 
11
 
 
12
typedef struct ocr0_shared {  /* shared variables and properties */
 
13
 
 
14
  struct box *box1;  /* box in whole image */
 
15
  pix *bp;           /* extracted temporarly box, cleaned */
 
16
  int cs;            /* global threshold value (gray level) */
 
17
 
 
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) */
 
24
 
 
25
} ocr0_shared_t;
 
26
 
 
27
/* tests for umlaut */
 
28
int testumlaut(struct box *box1, int cs, int m, wchar_t *modifier);
 
29
/* detect chars */
 
30
wchar_t ocr0(struct box *box1, pix  *b, int cs);
 
31
/* detect numbers */
 
32
wchar_t ocr0n(ocr0_shared_t *sdata);
 
33
 
 
34
static inline int sq(int x) { return x*x; } /* square */
 
35
 
 
36
/*
 
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
 
41
 */ 
 
42
int line_deviation( struct box *box1, int j1, int j2 );
 
43
 
 
44
/*
 
45
 * search vectors between j1 and j2 for nearest point a to point r 
 
46
 * example:
 
47
 * 
 
48
 *     r-> $$...$$   $ - mark vectors
 
49
 *         @@$..@@   @ - black pixels
 
50
 *         @@$..@@   . - white pixels
 
51
 *         @@@@.$@
 
52
 *     a-> @@$@$@@
 
53
 *         @$.@@@@
 
54
 *         @@..$@@
 
55
 *         @@..$@@
 
56
 *  j1 --> $$...$$ <-- j2
 
57
 *     
 
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
 
60
 *          return aa?
 
61
 */
 
62
int nearest_frame_vector( struct box *box1, int j1, int j2, int rx, int ry);
 
63
#endif