MEPP2 Project
contrastsensitivity.h
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as
6 // published by the Free Software Foundation; either version 3 of
7 // the License, or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
13 #include <cmath>
14 
15 #include "genericparametricmodel.h"
16 
17 //-----------------------------------------------------------------------------------
18 
24 
26  : public GenericParametricModel< Eigen::Vector3d, double, double >
27 {
28 
29  //-----------------------------------------------------------------------------------
30 
31 public:
34  {
36  }
37 
40  {
41  }
42 
43  virtual ~SarkisonCSF() {}
44 
45  //-----------------------------------------------------------------------------------
46 
47 public:
48  virtual void compute(const InputType &in, OutputType &out) const
49  {
50  out = (1.f - m_param(0) + in / m_param(1)) * exp(-pow(in, m_param(2)));
51  }
52 
53  //-----------------------------------------------------------------------------------
54 
55 protected:
59  virtual void default_params()
60  {
61  m_param = ParameterType(-15.13, 0.0096, 0.64);
62  }
63 };
64 
65 //=================================================================================//
66 
67 
74 
75 typedef Eigen::Matrix< double, 5, 1 > Vector5d;
76 
77 class BartenCSF
78  : public GenericParametricModel< Vector5d, Eigen::Vector2d, double >
79 {
80 
81  //-----------------------------------------------------------------------------------
82 
83 public:
85  {
87  }
88 
91  {
92  }
93 
94  virtual ~BartenCSF() {}
95 
96  //-----------------------------------------------------------------------------------
97 
98  virtual void compute(const InputType &in, OutputType &out) const
99  {
100  double f = in(0); // frequency
101  double l = in(1); // lumiance
102 
103  double A = m_param(0) * pow((1. + 0.7) / l, m_param(3));
104  double B = m_param(1) * pow((1. + 100.) / l, m_param(4));
105 
106  out = A * in(0) * exp(-B * f * sqrt(1 + m_param(2) * exp(B * f)));
107  }
108 
109  //-----------------------------------------------------------------------------------
110 
111 protected:
115  virtual void default_params() { m_param << 125.42, 0.009, 0.343, 0.17, 0.19; }
116 };
SarkisonCSF::SarkisonCSF
SarkisonCSF()
Definition: contrastsensitivity.h:32
genericparametricmodel.h
Vector5d
Eigen::Matrix< double, 5, 1 > Vector5d
Definition: contrastsensitivity.h:75
GenericParametricModel< Eigen::Vector3d, double, double >::InputType
double InputType
Definition: genericparametricmodel.h:24
BartenCSF
Definition: contrastsensitivity.h:79
GenericParametricModel< Eigen::Vector3d, double, double >::ParameterType
Eigen::Vector3d ParameterType
Definition: genericparametricmodel.h:23
GenericParametricModel< Eigen::Vector3d, double, double >::param
const ParameterType & param() const
Definition: genericparametricmodel.h:44
SarkisonCSF
Definition: contrastsensitivity.h:27
SarkisonCSF::compute
virtual void compute(const InputType &in, OutputType &out) const
Definition: contrastsensitivity.h:48
BartenCSF::default_params
virtual void default_params()
Definition: contrastsensitivity.h:115
BartenCSF::BartenCSF
BartenCSF()
Definition: contrastsensitivity.h:84
SarkisonCSF::~SarkisonCSF
virtual ~SarkisonCSF()
Definition: contrastsensitivity.h:43
SarkisonCSF::SarkisonCSF
SarkisonCSF(const ParameterType &param)
Definition: contrastsensitivity.h:38
SarkisonCSF::default_params
virtual void default_params()
Definition: contrastsensitivity.h:59
GenericParametricModel< Eigen::Vector3d, double, double >::m_param
ParameterType m_param
Definition: genericparametricmodel.h:88
BartenCSF::BartenCSF
BartenCSF(const ParameterType &param)
Definition: contrastsensitivity.h:89
BartenCSF::compute
virtual void compute(const InputType &in, OutputType &out) const
Definition: contrastsensitivity.h:98
GenericParametricModel
Definition: genericparametricmodel.h:18
GenericParametricModel< Eigen::Vector3d, double, double >::OutputType
double OutputType
Definition: genericparametricmodel.h:25
BartenCSF::~BartenCSF
virtual ~BartenCSF()
Definition: contrastsensitivity.h:94