chiark / gitweb /
use // comments for debug #defines
[ypp-sc-tools.db-test.git] / pctb / ocr.h
index 0824404579f753ca9ba65dd4d224258f188fdb5f..4b8ff05b9db1e760c528e54fb4d29448cb8f9bbc 100644 (file)
@@ -1,12 +1,16 @@
 #ifndef OCR_H
 #define OCR_H
 
+#define _GNU_SOURCE
+
 #include <pam.h>
 #include <stdint.h>
 #include <inttypes.h>
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 
@@ -16,17 +20,30 @@ typedef uint32_t Pixcol;
 typedef struct {
   const char *s; /* valid until next call to ocr() */
   int l,r; /* column numbers */
-  int ctx; /* match context index */
+  unsigned ctxmap; /* match context index */
 } OcrResultGlyph;
 
-OcrResultGlyph *ocr(int w, int h, Pixcol cols[]);
+typedef const struct OcrCellTypeInfo *OcrCellType;
+extern const struct OcrCellTypeInfo ocr_celltype_text;
+extern const struct OcrCellTypeInfo ocr_celltype_number;
+
+typedef struct OcrReader OcrReader;
+OcrReader *ocr_init(int h);
+
+OcrResultGlyph *ocr(OcrReader *rd, OcrCellType, int w, Pixcol cols[]);
   /* return value is array terminated by {0,-1,-1}
    * array is valid until next call to ocr()
    */
 
-void ocr_init(void);
+void debug_flush(void);
 
 #define eassert assert
 #define debug stdout
 
+const char *get_vardir(void);
+
+
+// #define DEBUG_RECTANGLES
+// #define DEBUG_OCR
+
 #endif /*OCR_H*/