PICCANTE  0.4
The hottest HDR imaging library!
filter_tmqi.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_TMQI_HPP
19 #define PIC_FILTERING_FILTER_TMQI_HPP
20 
21 #include "../util/math.hpp"
22 
23 #include "../filtering/filter.hpp"
24 
25 namespace pic {
26 
30 class FilterTMQI: public Filter
31 {
32 protected:
33 
34  float C1, C2;
35 
42  void ProcessBBox(Image *dst, ImageVec src, BBox *box)
43  {
44  for(int j = box->y0; j < box->y1; j++) {
45  for(int i = box->x0; i < box->x1; i++) {
46  float *out = (*dst)(i, j);
47 
48  float sigma1 = (*src[0])(i, j)[0];
49  float sigma1p = normalCDF(sigma1, u_hdr, sig_hdr);
50 
51  float sigma2 = (*src[1])(i, j)[0];
52  float sigma2p = normalCDF(sigma2, u_ldr, sig_ldr);
53 
54  float sigma12 = (*src[2])(i, j)[0];
55 
56  out[0] = (((2*sigma1p*sigma2p)+C1)/((sigma1p*sigma1p)+(sigma2p*sigma2p)+C1))*((sigma12+C2)/(sigma1*sigma2 + C2));
57  }
58  }
59  }
60 
62 
63 public:
64 
70  {
71  C1 = 0.01f;
72  C2 = 10.0f;
73  minInputImages = 3;
74  }
75 
81  static float MannosCSF(float sf)
82  {
83  return 100.0f * 2.6f *
84  (0.0192f + 0.114f * sf) *
85  expf(-powf(0.114f * sf, 1.1f));
86  }
87 
91  void update(float sf)
92  {
93  float CSF = MannosCSF(sf);
94 
95  u_hdr = 128.0f / (1.4f * CSF);
96  sig_hdr = u_hdr / 3.0f;
97 
98  u_ldr = u_hdr;
99  sig_ldr = u_ldr / 3.0f;
100  }
101 
102 };
103 
104 } // end namespace pic
105 
106 #endif /* PIC_FILTERING_FILTER_TMQI_HPP */
107 
The BBox class manages the creation of bounding boxes for images.
Definition: bbox.hpp:29
float u_hdr
Definition: filter_tmqi.hpp:61
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
float sig_ldr
Definition: filter_tmqi.hpp:61
int x0
Definition: bbox.hpp:32
void update(float sf)
update
Definition: filter_tmqi.hpp:91
The Filter class.
Definition: filter.hpp:50
void ProcessBBox(Image *dst, ImageVec src, BBox *box)
ProcessBBox.
Definition: filter_tmqi.hpp:42
float sig_hdr
Definition: filter_tmqi.hpp:61
float C1
Definition: filter_tmqi.hpp:34
FilterTMQI()
FilterTMQI.
Definition: filter_tmqi.hpp:69
float normalCDF(float x, float mu, float sigma)
normalCDF
Definition: math.hpp:478
float C2
Definition: filter_tmqi.hpp:34
int y0
Definition: bbox.hpp:32
The FilterTMQI class.
Definition: filter_tmqi.hpp:30
int minInputImages
Definition: filter_radial_basis_function.hpp:56
static float MannosCSF(float sf)
MannosCSF.
Definition: filter_tmqi.hpp:81
The Image class stores an image as buffer of float.
Definition: image.hpp:60
virtual void f(FilterFData *data)
f
Definition: filter_radial_basis_function.hpp:69
Definition: bilateral_separation.hpp:25
float u_ldr
Definition: filter_tmqi.hpp:61