reference/ocr-new/RLEMap.h
changeset 0 6b8091ca909a
equal deleted inserted replaced
-1:000000000000 0:6b8091ca909a
       
     1 #ifndef _RLEMap_H
       
     2 #define _RLEMap_H
       
     3 #include "system.h"
       
     4 #include "RLEPair.h"
       
     5 #include <math.h>
       
     6 
       
     7 
       
     8 
       
     9 /* The RLEMap Class is a run length encoded representation of a bitmap
       
    10    The I/O functions defined for this class read and write data from 
       
    11    TIFF format files using the Silicon Graphics TIFF library.
       
    12 
       
    13 */
       
    14 
       
    15 class RLEMap{
       
    16 	public:
       
    17 
       
    18 	// Constructor, Destructor and copy functions
       
    19       	RLEMap();
       
    20        ~RLEMap();
       
    21 
       
    22 	// Selector and Modifier functions
       
    23 
       
    24 	int & imageLength();
       
    25 	int & imageWidth();
       
    26 	inline int pixels_between(int start, int finish, int row_num){
       
    27 	  return fMapData[row_num]->pixelsBetween(start, finish);
       
    28 	};
       
    29 
       
    30 	MapStatus & status();
       
    31 	
       
    32   
       
    33 	void display_intervals(char* color);
       
    34         void display_intervals(char* window, double scaleFactor, 
       
    35 			       char * color);
       
    36 	ListElement* FindNearHorizDot(int startCol, int startRow, int endRow);
       
    37 	ListElement* FindNearVertDot(int startCol, int endCol, 
       
    38 				     int startRow, int endRow);
       
    39 
       
    40 	// I/O operations.  Read and Write are from/to 2 level TIFF files
       
    41 
       
    42 	  MapStatus readMap(char * filename);
       
    43 	MapStatus writeMap(char * filename);
       
    44 
       
    45 	// Data Access and low level manipulation functions  
       
    46 	 // Access a row of the Map 
       
    47 	 // usage: rmap[i] returns row i of the RLEMap.
       
    48 	 // row performs the same function  
       
    49 	RLEPairs  * operator [](int i);
       
    50 	RLEPairs * row(int i);
       
    51 
       
    52 	 int pixelsInRegion(Point  ul, Point  lr);
       
    53 	short int grayScale(Point  ul, Point  lr);
       
    54 
       
    55 
       
    56 	void tilt_and_slant(double, int);
       
    57 	int deskew(); 
       
    58 	void tilt(double , int);
       
    59 	void slant(double, int);
       
    60 	void tilt_row(int, int, RLEPairs** , double, int);
       
    61 	RLEPairs ** fMapData;    
       
    62 	// Array length = fImageLength One list
       
    63 	// for each row	
       
    64 
       
    65 
       
    66 	  // prints RLEMap representation for row range
       
    67 	void printPairs(int startRow, int endRow);  
       
    68 
       
    69 private:
       
    70 	// Size and status info
       
    71 	int fImageLength;
       
    72 	int fImageWidth;
       
    73 
       
    74 	MapStatus fStatus;
       
    75 };
       
    76 
       
    77 void printMap(RLEMap * map);
       
    78 void testpixelsBetween(RLEMap * map);
       
    79 double get_skew(RLEMap*);
       
    80 
       
    81 #endif
       
    82 
       
    83 
       
    84 
       
    85 
       
    86 
       
    87 
       
    88 
       
    89 
       
    90 
       
    91 
       
    92 
       
    93 
       
    94 
       
    95 
       
    96 
       
    97 
       
    98 
       
    99 
       
   100 
       
   101 
       
   102 
       
   103 
       
   104 
       
   105