reference/ocr-simple/BitMap.h
author viric@llimona
Thu, 18 May 2006 23:12:51 +0200
changeset 0 6b8091ca909a
permissions -rw-r--r--
Init from working directory of svn repository.

#ifndef _BITMAP_H
#define _BITMAP_H
#include "system.h"

/** A BitMap representation stores image in an array of unsigned character
    arrays.  There is one uchar array per row.  Each bit of the uchar 
    represents a pixel.
***/


class RLEMap;
class Point;
class BitMap;

extern void byteprint(char d);
extern void bitprint(char d, int x);

class BitMap{
 public:
  friend MapStatus convertMap(RLEMap *,BitMap*,Point,Point);
  BitMap();

  ~BitMap();

  int & imageLength() 
    {return fImageLength;};

  int & imageWidth()
    {return fImageWidth;};

  MapStatus & status()
    {return fStatus; };

  uchar * row(int i);         // returns a pointer to row i


  // I/O operations.  readMap and writeMap are from/to 2 level TIFF files

  MapStatus readMap(char * filename);
  MapStatus writeMap(char * filename);   // not done
    
  // Write out BitMap format for TCL/TK display
  MapStatus writeTclMap(char * filename, Point & ul, Point & lr, int scaledown);
  // Detect skew Angle 
  Angle skewAngle();
 
  //Rotate the map designated angle.  
  MapStatus rotateMap(Angle angl); 
  

  // Return a ratio of black pixels to white pixels
  // scaled to 255 0 = all white 255=all black
  short int grayScale(Point & ul, Point & lr);

  // number of black pixels in bounding box
  int BitMap::pixelsInRegion(Point  ul, Point lr);

private:
 

	int fImageWidth;
	int fImageLength;
	MapStatus fStatus;
	uchar ** fMapData;

} ;



#endif