chiark / gitweb /
wip pager - before change to not converting until sure
[ypp-sc-tools.web-live.git] / pctb / ocr.h
index d08ae15ba8b0878a990b0a135e39fbf84cdbb0e9..d9a25f7a790da26812b5352a5d397f4c94e18352 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdarg.h>
+#include <time.h>
+
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <sys/time.h>
+
+
+typedef struct {
+  int w,h;
+  char d[];
+} CanonImage;
+
 
 typedef uint32_t Pixcol;
 #define PSPIXCOL(priscan) priscan##32
@@ -19,17 +30,17 @@ 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;
 
-typedef const struct OcrGlyphContextDeveloperInfo *OcrCellContext;
-extern const struct OcrGlyphContextDeveloperInfo *ocr_celltype_text;
-extern const struct OcrGlyphContextDeveloperInfo *ocr_celltype_number;
+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, int w, Pixcol cols[]);
+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()
    */
@@ -41,4 +52,15 @@ void debug_flush(void);
 
 const char *get_vardir(void);
 
+CanonImage *file_read_image(FILE *f);
+int main_test(void);
+
+#define MAX_PAGES 100
+extern CanonImage *page_images[MAX_PAGES];
+extern int npages;
+
+
+#define DEBUG_RECTANGLES
+// #define DEBUG_OCR
+
 #endif /*OCR_H*/