#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 );




private:
    void ReadSettings(const std::string inFile);
    void NormalizeImage();

    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
