OptIm32.h

00001 # ifndef OptIm32_h
00002 # define OptIm32_h OptIm32_h
00003 
00004 // ####################################################################
00005 // # SomeName: An Extensible Optical Character Recognition Framework  #
00006 // #                                                                  #
00007 // # Copyright: Lesser GNU Public License (LGPL)                      #
00008 // #                                                                  #
00009 // # Overview:                                                        #
00010 // #  - SomeName is a collection of C++ classes, and an OCR engine    #
00011 // #  - SomeName is designed to allow customization at all levels     #
00012 // #    and to encourage individuals to contribute incremental        #
00013 // #    improvements in algorithms.                                   #
00014 // #  - Overall design discussions can be found in                    #
00015 // #      $SNROOT/docs/doxygen/html/index.html                        #
00016 // #  - SomeName is designed to interact with and build on other      #
00017 // #    open-source OCR programs.                                     #
00018 // ####################################################################
00019 
00020 # include <vector>
00021 # include "Root.h"  // parent
00022 # include "PixelLine32.h" // has-a
00023 
00024 namespace SomeName {
00025     class Image;
00026     class ImageArgs;
00027     
00028     // ##################################################################
00073     // ##################################################################
00074     class OptIm32 : public Root {
00075       public:
00076         // Constructors/Destructors
00077         OptIm32(const Image* image, const ImageArgs& config);
00078         OptIm32(const std::vector<unsigned int>& rows, u1 width = PixelLine32::MaxPixels);
00079         
00080         // **************
00081         // Accessors
00082         inline const u1 & width() const { return this->_width; }
00083         inline const std::vector<PixelLine32> & cols() const { return this->_cols; }
00084         inline const std::vector<PixelLine32> & rows() const { return this->_rows; }
00085         
00086         // **************
00087         // Input/Output
00088         
00089         // **************
00090         // Interface
00091         void init(const std::vector<unsigned int>& rows, u1 width);
00092 
00094         int rblack(u1 i) const { return this->rows()[i].black(); }
00096         int rholes(u1 i) const { return this->rows()[i].holes(); }
00098         int cblack(u1 i) const { return this->cols()[i].black(); }
00100         int choles(u1 i) const { return this->cols()[i].holes(); }
00101 
00105         std::string str(char on = '#', char off = '.') const;
00106 
00107         static void test(int argc = 0, const char* argv[] = NULL);
00108         
00109       protected:
00110         // **************
00111         // Accessors
00112         inline void  widthIs(const u1 & width)                   { this->_width = width; }
00113         inline void  colsIs(const std::vector<PixelLine32> & cols) { this->_cols  = cols;  }
00114         inline void  rowsIs(const std::vector<PixelLine32> & rows) { this->_rows  = rows;  }
00115         
00116         // **************
00117         // Methods 
00118         std::string rawstr(const std::vector<PixelLine32>& vec, char on = '1', char off = '0', unsigned char size = PixelLine32::MaxPixels) const;    
00119         
00120       private: 
00121         // **************
00122         // Accessors
00123         inline u1& widthRef()                     { return this->_width; }
00124         inline std::vector<PixelLine32>& colsRef()  { return this->_cols; }
00125         inline std::vector<PixelLine32>& rowsRef()  { return this->_rows; }
00126 
00127         
00128         // **************
00129         // Methods 
00130         
00131         // **************
00132         // State
00133         u1                     _width;
00134         std::vector<PixelLine32> _cols;
00135         std::vector<PixelLine32> _rows;
00136     };
00137 }
00138 
00139 # endif // OptIm32_h
00140 

Generated on Thu Jun 8 11:53:13 2006 for SomeName by  doxygen 1.4.6