summaryrefslogtreecommitdiff
blob: 5685cd3e399af746404e058824fc5f421ede2258 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* Copyright (C) 2020-2021 Artifex Software, Inc.
   All Rights Reserved.

   This software is provided AS-IS with no warranty, either express or
   implied.

   This software is distributed under license and may not be copied,
   modified or distributed except as expressly authorized under the terms
   of the license contained in the file LICENSE in this distribution.

   Refer to licensing information at http://www.artifex.com or contact
   Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
   CA 94945, U.S.A., +1(415)492-9861, for further information.
*/


/* Simple veneer for tesseract */

#ifndef tessocr_h_INCLUDED
#  define tessocr_h_INCLUDED

#include "gsmemory.h"

enum
{
    OCR_ENGINE_DEFAULT = 0,
    OCR_ENGINE_LSTM = 1,
    OCR_ENGINE_LEGACY = 2,
    OCR_ENGINE_BOTH = 3
};

int ocr_init_api(gs_memory_t  *mem,
           const char         *language,
		 int           engine,
		 void        **state);

void ocr_fin_api(gs_memory_t *mem,
		 void        *state);

int ocr_recognise(void *state,
		  int   w,
		  int   h,
		  void *data,
                  int   xres,
		  int   yres,
                  int (*callback)(void *, const char *, const int *, const int *, const int *, int),
                  void *arg);

int ocr_bitmap_to_unicodes(void *state,
                     const void *data,
			   int   data_x,
                           int   w,
			   int   h,
			   int   raster,
                           int   xres,
			   int   yres,
			   int  *unicode,
			   int  *char_count);

int ocr_image_to_utf8(void  *state,
                      int    w,
		      int    h,
		      int    bpp,
		      int    raster,
                      int    xres,
		      int    yres,
                      void  *data,
		      int    restore_data,
                      char **out);

int ocr_image_to_hocr(void  *state,
                      int    w,
		      int    h,
		      int    bpp,
		      int    raster,
                      int    xres,
		      int    yres,
		      void  *data,
		      int    restore,
                      int    pagecount,
		      char **out);

#endif