2 This is a Optical-Character-Recognition program
3 Copyright (C) 2000-2006 Joerg Schulenburg
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 see README for EMAIL-address
32 #define pixel_at(pic, xx, yy) (pic).p[(xx)+((yy)*((pic).x))]
33 #define pixel_atp(pic, xx, yy) (pic)->p[(xx)+((yy)*((pic)->x))]
36 const wchar_t *wcschr (const wchar_t *wcs, wchar_t wc);
37 const wchar_t *wcscpy (wchar_t *dest, const wchar_t *src);
38 size_t wcslen (const wchar_t *s);
41 wchar_t * wcsdup (const wchar_t *WS); /* its a gnu extension */
44 /* declared in pgm2asc.c */
45 /* set alternate chars and its weight, called from the engine
46 if a char is recognized to (weight) percent */
47 int setas(struct box *b, char *as, int weight); /* string + xml */
48 int setac(struct box *b, wchar_t ac, int weight); /* wchar */
50 /* for qsort() call */
51 int intcompare (const void *vr, const void *vs);
53 /* declared in box.c */
54 int box_gt(struct box *box1, struct box *box2);
55 int reset_box_ac(struct box *box); /* reset and free char table */
56 struct box *malloc_box( struct box *inibox ); /* alloc memory for a box */
57 int free_box( struct box *box ); /* free memory of a box */
58 int copybox( pix *p, int x0, int y0, int dx, int dy, pix *b, int len);
59 int reduce_vectors ( struct box *box1, int mode );
60 int merge_boxes( struct box *box1, struct box *box2 );
61 int cut_box( struct box *box1);
64 /* declared in database.c */
66 wchar_t ocr_db(struct box *box1);
68 /* declared in detect.c */
69 int detect_lines1(pix * p, int x0, int y0, int dx, int dy);
70 int detect_lines2(pix *p,int x0,int y0,int dx,int dy,int r);
71 int detect_rotation_angle(job_t *job);
72 int detect_text_lines(pix * pp, int mo);
73 int adjust_text_lines(pix * pp, int mo);
74 int detect_pictures(job_t *job);
76 /* declared in lines.c */
77 void store_boxtree_lines( int mo );
78 /* free memory for internal stored textlines.
79 * Needs to be called _after_ having retrieved the text.
80 * After freeing, no call to getTextLine is possible any
83 void free_textlines( void );
85 /* get result of ocr for a given line number.
86 * If the line is out of range, the function returns 0,
87 * otherwise a pointer to a complete line.
89 const char *getTextLine( int );
91 /* declared in remove.c */
92 int remove_dust( job_t *job );
93 int remove_pictures( job_t *job);
94 int remove_melted_serifs( pix *pp );
95 int remove_rest_of_dust();
96 int smooth_borders( job_t *job );
98 /* declared in pixel.c */
99 int marked(pix * p, int x, int y);
100 int pixel(pix *p, int x, int y);
101 void put(pix * p, int x, int y, int ia, int io);
103 /* start ocr on a image in job.src.p */
104 int pgm2asc(job_t *job);