X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=pctb%2Focr.h;h=b77a56f8905f5269cddedc4d33de783490ece33a;hb=d3eaa28d304c5b0639bc0f7e29b3285317d5c1e7;hp=26bccbc7b83b81bb693b27995063ed7cedbecc1d;hpb=a7c52a5cdad0b1a4c4e053992858674e8d7953a7;p=ypp-sc-tools.web-live.git diff --git a/pctb/ocr.h b/pctb/ocr.h index 26bccbc..b77a56f 100644 --- a/pctb/ocr.h +++ b/pctb/ocr.h @@ -1,12 +1,16 @@ #ifndef OCR_H #define OCR_H +#define _GNU_SOURCE + #include #include #include #include #include #include +#include +#include #include #include @@ -16,19 +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*/