pagenormalizer.h 791 B

1234567891011121314151617181920212223242526272829303132333435363738
  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);
  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. };
  26. #endif