OptIm15.h

00001 # ifndef OptIm15_h
00002 # define OptIm15_h OptIm15_h
00003 
00004 // ####################################################################
00005 // # Conjecture: An Extensible Optical Character Recognition Framework  #
00006 // #                                                                  #
00007 // # Copyright: GNU Public License                                    #
00008 // #                                                                  #
00009 // # Overview:                                                        #
00010 // #  - Conjecture is a collection of C++ classes, and an OCR engine    #
00011 // #  - Conjecture 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 // #  - Conjecture 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 "PixelLine15.h" // has-a
00023 
00024 namespace Conjecture {
00025   class Image;
00026   class ImageArgs;
00027 
00028   // ##################################################################
00069 
00070   // ##################################################################
00071   class OptIm15 : public Root {
00072   public:
00073     // Constructors/Destructors
00074     OptIm15(const Image* image, const ImageArgs& config);
00075     OptIm15(const std::vector<unsigned int>& rows, unsigned char width = 15);
00076 
00077     // **************
00078     // Accessors
00079     inline const uint8_t & width() const { return this->_width; }
00080     inline const std::vector<PixelLine15> & cols() const { return this->_cols; }
00081     inline const std::vector<PixelLine15> & rows() const { return this->_rows; }
00082     
00083     // **************
00084     // Input/Output
00085     
00086     // **************
00087     // Interface
00088 
00089     void init(const std::vector<unsigned int>& rows, unsigned char width);
00090 
00092     int rblack(unsigned char i) const { return this->rows()[i].black(); }
00094     int rholes(unsigned char i) const { return this->rows()[i].holes(); }
00096     int cblack(unsigned char i) const { return this->cols()[i].black(); }
00098     int choles(unsigned char i) const { return this->cols()[i].holes(); }
00099 
00103     std::string str(char on = '#', char off = '.') const; // , unsigned char size = 15) const;
00104 
00105     static void test(int argc = 0, const char* argv[] = NULL);
00106 
00107   protected:
00108     // **************
00109     // Accessors
00110     inline void            widthIs(const uint8_t & width) { this->_width = width; }
00111     inline void            colsIs(const std::vector<PixelLine15> & cols) { this->_cols = cols; }
00112     inline void            rowsIs(const std::vector<PixelLine15> & rows) { this->_rows = rows; }
00113     
00114     // **************
00115     // Methods 
00116     std::string rawstr(const std::vector<PixelLine15>& vec, char on = '1', char off = '0', unsigned char size = 15) const;    
00117     
00118   private: 
00119     // **************
00120     // Accessors
00121     inline uint8_t&                widthRef() { return this->_width; }
00122     inline std::vector<PixelLine15>& colsRef()  { return this->_cols; }
00123     inline std::vector<PixelLine15>& rowsRef()  { return this->_rows; }
00124     
00125     // **************
00126     // Methods 
00127 
00128     // **************
00129     // State
00130     uint8_t                _width;
00131     std::vector<PixelLine15> _cols;
00132     std::vector<PixelLine15> _rows;
00133   };
00134 }
00135 
00136 # endif // OptIm15_h
00137 

Generated on Thu Jun 15 19:56:10 2006 for Conjecture by  doxygen 1.4.6