chiark / gitweb /
Seems to be able to do the whole thing
[ypp-sc-tools.web-live.git] / pctb / convert.c
index 93c713708187bfe04361c4f34cac039f3960eaf0..f90ca4a450456d3b5d437e4a093da3569fa6f975 100644 (file)
@@ -30,6 +30,7 @@ static inline char get_p(Point p) { return get(p.x,p.y); }
 #define START_MAIN {200,200}
 #define MIN_COLUMNS         6
 #define INTERESTING_COLUMNS 6
+#define TEXT_COLUMNS        2
 #define MAX_COLUMNS         7
 
 static Rect mainr = { START_MAIN,START_MAIN };
@@ -238,7 +239,7 @@ static void load_image_and_canonify(void) {
   debug_flush();
 }
 
-static void ocr_rectangle(Rect r) {
+static void ocr_rectangle(Rect r, const OcrCellType ct) {
   OcrResultGlyph *results, *res;
 
   int w= r.br.x - r.tl.x + 1;
@@ -257,7 +258,7 @@ static void ocr_rectangle(Rect r) {
   }
   cols[w]= 0;
 
-  results= ocr(rd,w,cols);
+  results= ocr(rd,ct,w,cols);
   printf("YES! \"");
   for (res=results; res->s; res++)
     printf("%s",res->s);
@@ -282,7 +283,10 @@ int main(void) {
     
     for (colno=0; colno<MIN_COLUMNS; colno++) {
       find_table_entry(thisr,colno,&entryr);
-      ocr_rectangle(entryr);
+      ocr_rectangle(entryr,
+                   colno<TEXT_COLUMNS
+                   ? &ocr_celltype_text
+                   : &ocr_celltype_number);
     }
   }
   return 0;