polaroid-pp

Schlieren and contour plot tool
git clone https://git.0xfab.ch/polaroid-pp.git
Log | Files | Refs | Submodules | README | LICENSE

GammaCorrection.h (728B)


      1 // File       : GammaCorrection.h
      2 // Date       : Sun 01 May 2016 11:22:38 PM CEST
      3 // Author     : Fabian Wermelinger
      4 // Description: Gamma Correction Filter
      5 // Copyright 2016 ETH Zurich. All Rights Reserved.
      6 #ifndef GAMMACORRECTION_H_4SYE23BR
      7 #define GAMMACORRECTION_H_4SYE23BR
      8 
      9 #include <cmath>
     10 #include "ArgumentParser.h"
     11 
     12 class GammaCorrection
     13 {
     14 private:
     15     ArgumentParser& m_parser;
     16 
     17 public:
     18     GammaCorrection(ArgumentParser& parser) : m_parser(parser) {}
     19 
     20     inline Real operator()(const Real v) const
     21     {
     22         const Real gamma = m_parser("-gamma").asDouble(1.0);
     23         const Real A     = m_parser("-gammaA").asDouble(1.0);
     24         return A*std::pow(v, gamma);
     25     }
     26 };
     27 
     28 #endif /* GAMMACORRECTION_H_4SYE23BR */