X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=pctb%2Focr.h;h=a03f1f508dfc5e350f589a9a458c8b138a1783e7;hb=5a2c03e2e4f52b8329f45cf67afc3edec1f2c65b;hp=0824404579f753ca9ba65dd4d224258f188fdb5f;hpb=ad09cd7cce6584c63c275d7ed1106e66959b3f9d;p=ypp-sc-tools.db-test.git diff --git a/pctb/ocr.h b/pctb/ocr.h index 0824404..a03f1f5 100644 --- a/pctb/ocr.h +++ b/pctb/ocr.h @@ -1,12 +1,15 @@ #ifndef OCR_H #define OCR_H +#define _GNU_SOURCE + #include #include #include #include #include #include +#include #include #include @@ -16,17 +19,26 @@ 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); + #endif /*OCR_H*/