pagenormalizer.h 894 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef PAGENORMALIZER_H
  2. #define PAGENORMALIZER_H
  3. #define cimg_use_jpeg
  4. #include "CImg.h"
  5. using namespace cimg_library;
  6. class PageNormalizer
  7. {
  8. public:
  9. PageNormalizer();
  10. 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 );
  11. private:
  12. void ReadSettings(const std::string inFile);
  13. void NormalizeImage();
  14. void RotateImage(const int rotAngle);
  15. int GetWhiteness(unsigned int x,unsigned int y);
  16. int GetBlackness(unsigned int x,unsigned int y);
  17. CImg<unsigned char> inImage;
  18. CImg<unsigned char> refImages[2]; // One for white(0) and one for black(1)
  19. CImg<unsigned char> outImage;
  20. int width;
  21. int height;
  22. int cropX0;
  23. int cropY0;
  24. int cropX1;
  25. int cropY1;
  26. bool m_quiet;
  27. };
  28. #endif