pagenormalizer.h 834 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 );
  11. private:
  12. void ReadSettings(const std::string inFile);
  13. void NormalizeImage();
  14. int GetWhiteness(unsigned int x,unsigned int y);
  15. int GetBlackness(unsigned int x,unsigned int y);
  16. CImg<unsigned char> inImage;
  17. CImg<unsigned char> refImages[2]; // One for white(0) and one for black(1)
  18. CImg<unsigned char> outImage;
  19. int width;
  20. int height;
  21. int cropX0;
  22. int cropY0;
  23. int cropX1;
  24. int cropY1;
  25. bool m_quiet;
  26. };
  27. #endif