PICCANTE  0.4
The hottest HDR imaging library!
filter_simple_tmo.hpp
Go to the documentation of this file.
1 /*
2 
3 PICCANTE
4 The hottest HDR imaging library!
5 http://vcg.isti.cnr.it/piccante
6 
7 Copyright (C) 2014
8 Visual Computing Laboratory - ISTI CNR
9 http://vcg.isti.cnr.it
10 First author: Francesco Banterle
11 
12 This Source Code Form is subject to the terms of the Mozilla Public
13 License, v. 2.0. If a copy of the MPL was not distributed with this
14 file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 
16 */
17 
18 #ifndef PIC_FILTERING_FILTER_SIMPLE_TMO_HPP
19 #define PIC_FILTERING_FILTER_SIMPLE_TMO_HPP
20 
21 #include "../filtering/filter.hpp"
22 
23 namespace pic {
24 
28 class FilterSimpleTMO: public Filter
29 {
30 protected:
31  float gamma, fstop, exposure;
32 
37  void f(FilterFData *data)
38  {
39  float *dataIn = (*data->src[0])(data->x, data->y);
40 
41  for(int k = 0; k < data->dst->channels; k++) {
42  data->out[k] = powf((dataIn[k] * exposure), gamma);
43  }
44  }
45 
46 public:
52  FilterSimpleTMO(float gamma, float fstop) : Filter()
53  {
54  update(gamma, fstop);
55  }
56 
62  void update(float gamma, float fstop)
63  {
64  this->gamma = 1.0f / gamma;
65  this->fstop = fstop;
66  exposure = powf(2.0f, fstop);
67  }
68 
77  static Image *execute(Image *imgIn, Image *imgOut, float gamma,
78  float fstop)
79  {
80  FilterSimpleTMO filter(gamma, fstop);
81  return filter.Process(Single(imgIn), imgOut);
82  }
83 };
84 
85 } // end namespace pic
86 
87 #endif /* PIC_FILTERING_FILTER_SIMPLE_TMO_HPP */
88 
int y
Definition: filter.hpp:39
int channels
Definition: image.hpp:80
The Filter class.
Definition: filter.hpp:50
void f(FilterFData *data)
f
Definition: filter_simple_tmo.hpp:37
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
The FilterSimpleTMO class.
Definition: filter_simple_tmo.hpp:28
Definition: filter.hpp:37
Image * dst
Definition: filter.hpp:42
float * out
Definition: filter.hpp:40
float exposure
Definition: filter_simple_tmo.hpp:31
void update(float gamma, float fstop)
update
Definition: filter_simple_tmo.hpp:62
int x
Definition: filter.hpp:39
The Image class stores an image as buffer of float.
Definition: image.hpp:60
float fstop
Definition: filter_simple_tmo.hpp:31
ImageVec src
Definition: filter.hpp:43
PIC_INLINE ImageVec Single(Image *img)
Single creates an std::vector which contains img; this is for filters input.
Definition: image_vec.hpp:36
Definition: bilateral_separation.hpp:25
static Image * execute(Image *imgIn, Image *imgOut, float gamma, float fstop)
execute
Definition: filter_simple_tmo.hpp:77
float gamma
Definition: filter_simple_tmo.hpp:31
FilterSimpleTMO(float gamma, float fstop)
FilterSimpleTMO.
Definition: filter_simple_tmo.hpp:52