reference/ocr-new/RLEMap.h
changeset 0 6b8091ca909a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/reference/ocr-new/RLEMap.h	Thu May 18 23:12:51 2006 +0200
@@ -0,0 +1,105 @@
+#ifndef _RLEMap_H
+#define _RLEMap_H
+#include "system.h"
+#include "RLEPair.h"
+#include <math.h>
+
+
+
+/* The RLEMap Class is a run length encoded representation of a bitmap
+   The I/O functions defined for this class read and write data from 
+   TIFF format files using the Silicon Graphics TIFF library.
+
+*/
+
+class RLEMap{
+	public:
+
+	// Constructor, Destructor and copy functions
+      	RLEMap();
+       ~RLEMap();
+
+	// Selector and Modifier functions
+
+	int & imageLength();
+	int & imageWidth();
+	inline int pixels_between(int start, int finish, int row_num){
+	  return fMapData[row_num]->pixelsBetween(start, finish);
+	};
+
+	MapStatus & status();
+	
+  
+	void display_intervals(char* color);
+        void display_intervals(char* window, double scaleFactor, 
+			       char * color);
+	ListElement* FindNearHorizDot(int startCol, int startRow, int endRow);
+	ListElement* FindNearVertDot(int startCol, int endCol, 
+				     int startRow, int endRow);
+
+	// I/O operations.  Read and Write are from/to 2 level TIFF files
+
+	  MapStatus readMap(char * filename);
+	MapStatus writeMap(char * filename);
+
+	// Data Access and low level manipulation functions  
+	 // Access a row of the Map 
+	 // usage: rmap[i] returns row i of the RLEMap.
+	 // row performs the same function  
+	RLEPairs  * operator [](int i);
+	RLEPairs * row(int i);
+
+	 int pixelsInRegion(Point  ul, Point  lr);
+	short int grayScale(Point  ul, Point  lr);
+
+
+	void tilt_and_slant(double, int);
+	int deskew(); 
+	void tilt(double , int);
+	void slant(double, int);
+	void tilt_row(int, int, RLEPairs** , double, int);
+	RLEPairs ** fMapData;    
+	// Array length = fImageLength One list
+	// for each row	
+
+
+	  // prints RLEMap representation for row range
+	void printPairs(int startRow, int endRow);  
+
+private:
+	// Size and status info
+	int fImageLength;
+	int fImageWidth;
+
+	MapStatus fStatus;
+};
+
+void printMap(RLEMap * map);
+void testpixelsBetween(RLEMap * map);
+double get_skew(RLEMap*);
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+