--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/reference/ocr-new/system.h Thu May 18 23:12:51 2006 +0200
@@ -0,0 +1,185 @@
+#ifndef _SYSTEM_H
+#define _SYSTEM_H
+#include <stdio.h>
+#include <stdlib.h>
+#include "/usr/sww/share/include/tiffio.h"
+#include <assert.h>
+#include <bool.h>
+#include <iostream.h>
+#include <stream.h>
+#include <stdlib.h>
+
+/* system.h - typedefs and globals for OCRchie system **/
+/** enums and typdefs for OCRSystem include .h files */
+
+
+enum MapStatus { EMPTY, VALID, OPENERROR, READERROR, WRITEERROR,
+ OTHERERROR };
+
+enum TclMode {REGULAR, ZONING};
+
+typedef double Angle;
+typedef unsigned char uchar;
+typedef unsigned int Confidence;
+
+typedef unsigned long int Distance;
+
+typedef short int Property;
+typedef char Character;
+
+
+/** The number of properties in the property vector for components */
+extern int numProperties;
+
+/** Some variables for fine tuning OCR */
+/** These variables can be changed without recompiling in link_vars.tcl */
+
+extern int NoiseTolerance; // Minimum number of pixels in row of text
+extern int MinLineSize; // Minimum number of rows in a line of text
+extern int MinVertSeparation; // Minimum number of rows between lines of tex
+extern int MinHorizSeparation; // Minimum number of blank pixels btween chars
+extern int ConfidenceThreshold;// Minimum confidence for some operations
+extern int JoinTolerance; // Maximum number of pixels in a column
+ // joining two fused characters
+extern int MinComponentSize; //Minimum size in pixels of smallest char
+
+// The next four are used in character grouping
+
+extern int MaxVertSize; // Max vert pixels in char (used for baseline)
+extern int BaseLineTolerance; // How far from baseline is okay 1/%linesize
+extern int TopLineTolerance; // How far from topline is okay 1/%linesize
+
+
+/** Variables for user interface can be set in the file link_vars.tcl **/
+
+extern int ENABLE_USER_INTERFACE;
+extern int VERY_LOW_CONFIDENCE;
+extern int LOW_CONFIDENCE;
+extern int DISPLAY_LINE_BOUNDARIES;
+extern int DISPLAY_BOUNDING_BOXES;
+extern int SPELLCHECK;
+extern int DISPLAY_IMAGE;
+#define RLE_DESKEW 1
+#define BITMAP_DESKEW 0;
+#define MINIMUM_SKEW_ANGLE 0.25
+extern int DESKEW_METHOD;
+extern double SCALE_FACTOR;
+extern double ZONING_SCALE_FACTOR;
+extern TclMode mode;
+
+/***** end link_vars.tcl section ****/
+#include "Point.h"
+#include "list.h"
+#include "BitMap.h"
+#include "Component.h"
+#include "Word.h"
+#include "learn.h"
+#include "RLEPair.h"
+#include "RLEMap.h"
+#include "EqnMarker.h"
+#include "Zone.h"
+
+
+// Define C++ mode for tiff library
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+
+
+
+extern Point NOPNT; // Just a convenient empty point.
+
+
+/* Constants for the number of horizontal and vertical divisions
+ for determining the gray scale property vector for each component */
+
+extern int NumHorizDiv; //Number of horizontal divisions
+extern int NumVertDiv; //Number of vertical divisions
+
+extern Component * LearnedChars; /** Averaged learned chars NOT USED */
+
+extern unsigned int NumCharGroups;
+extern Components * LearnedGroups; // An array of 5 learned characters
+ //group lists
+
+/** The next 3 are set during learning ***/
+extern double MaxHWRatio; // Max H/W ratio of learned set
+extern double MinHWRatio;
+extern int MinWidth; // minimum component width in learned set
+
+extern uchar CharBitsSet[]; //a table of the number of bits set // in a character
+ // initialized in initCharBitsSet()
+
+
+
+
+
+
+// *** Global function declaration ***
+// functions in RLEMap.cc
+
+void testocr(int argc, char **argv);
+void testRLEMap(char * filename); // Right now in RLEMap.cc
+void testBitMap(char * filename); // Right now in BitMap.cc
+void testpixelsBetween(RLEMap * map); // in RLEMap.cc tests center row
+void printMap(RLEMap * map); // just an ascii "X" display
+
+
+// functions in BitMap.cc
+void testPixelsInRegion(BitMap * bmap, RLEMap * rmap);
+
+// functions in convertMap.cc
+void testConvertMap(char * filename);
+
+// functions in Component.cc
+void printVector(short int vector[], int size); // just prints contents
+
+// prints properties of component c using grayscales from map.
+void testProperties(Component* c, BitMap * map);
+
+
+ // functions in learn.cc
+Components * readLearnedChars(char * tiffFile, char * transFile);
+ /** Read Learned characters uses a tiffFile and a
+ ASCII translation file to read in a component list for
+ for comparison ***/
+
+// in system.cc
+void initCharBitsSet();
+void invertBitsInBuffer(uchar * buf, int size);
+void clearBitsInBuffer(uchar * buf, int size);
+
+short int countBitsSet(uchar c);
+int pixelsBetween(uchar * ar, int start, int end);
+void setRange(uchar ar[], int start, int end);
+char* backslashify(char*);
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+