1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #ifndef PAGENORMALIZER_H
- #define PAGENORMALIZER_H
- #define cimg_use_jpeg
- #include "CImg.h"
- using namespace cimg_library;
- class PageNormalizer
- {
- public:
- PageNormalizer();
- PageNormalizer(const std::string inFile,const std::string outFile,const std::string whiteRef,const std::string blackRef,const std::string settingsFile, const bool quiet, const int rotate );
- private:
- void ReadSettings(const std::string inFile);
- void NormalizeImage();
- void RotateImage(const int rotAngle);
- int GetWhiteness(unsigned int x,unsigned int y);
- int GetBlackness(unsigned int x,unsigned int y);
-
- CImg<unsigned char> inImage;
- CImg<unsigned char> refImages[2]; // One for white(0) and one for black(1)
- CImg<unsigned char> outImage;
- int width;
- int height;
- int cropX0;
- int cropY0;
- int cropX1;
- int cropY1;
-
- bool m_quiet;
- };
- #endif
|