PICCANTE  0.4
The hottest HDR imaging library!
drago_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_TONE_MAPPING_DRAGO_TMO_HPP
19 #define PIC_TONE_MAPPING_DRAGO_TMO_HPP
20 
21 #include "../base.hpp"
22 
23 #include "../filtering/filter.hpp"
24 #include "../filtering/filter_luminance.hpp"
25 #include "../filtering/filter_drago_tmo.hpp"
26 #include "../tone_mapping/tone_mapping_operator.hpp"
27 
28 namespace pic {
29 
34 {
35 protected:
36  float Ld_Max, b;
39 
46  Image *ProcessAux(ImageVec imgIn, Image *imgOut)
47  {
48  updateImage(imgIn[0]);
49 
50  //compute luminance and its statistics
51  images[0] = flt_lum.Process(imgIn, images[0]);
52 
53  float Lw_Max, Lw_a;
54  images[0]->getMaxVal(NULL, &Lw_Max);
55  images[0]->getLogMeanVal(NULL, &Lw_a);
56 
57  //tone map
58  flt_drg.update(Ld_Max, b, Lw_Max, Lw_a);
59  imgOut = flt_drg.Process(Double(imgIn[0], images[0]), imgOut);
60 
61  return imgOut;
62  }
63 
64 public:
65 
71  DragoTMO(float Ld_Max = 100.0f, float b = 0.95f) : ToneMappingOperator()
72  {
73  images.push_back(NULL);
74  update(Ld_Max, b);
75  }
76 
78  {
79  release();
80  }
81 
87  void update(float Ld_Max = 100.0f, float b = 0.95f)
88  {
89  this->Ld_Max = Ld_Max;
90  this->b = b;
91 
92  }
93 
100  static Image *execute(Image *imgIn, Image *imgOut)
101  {
102  DragoTMO dtmo(100.0f, 0.95f);
103  return dtmo.Process(Single(imgIn), imgOut);
104  }
105 };
106 } // end namespace pic
107 
108 #endif /* PIC_TONE_MAPPING_DRAGO_TMO_HPP */
109 
Image * Process(ImageVec imgIn, Image *imgOut=NULL)
Process.
Definition: tone_mapping_operator.hpp:120
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
ImageVec images
Definition: tone_mapping_operator.hpp:35
The ToneMappingOperator class.
Definition: tone_mapping_operator.hpp:31
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
The FilterLuminance class.
Definition: filter_luminance.hpp:33
static Image * execute(Image *imgIn, Image *imgOut)
execute
Definition: drago_tmo.hpp:100
~DragoTMO()
Definition: drago_tmo.hpp:77
float b
Definition: drago_tmo.hpp:36
DragoTMO(float Ld_Max=100.0f, float b=0.95f)
DragoTMO.
Definition: drago_tmo.hpp:71
void update(float Ld_Max=100.0f, float b=0.95f)
update
Definition: drago_tmo.hpp:87
void updateImage(Image *imgIn)
updateImage
Definition: tone_mapping_operator.hpp:78
void release()
release
Definition: tone_mapping_operator.hpp:68
PIC_INLINE ImageVec Double(Image *img1, Image *img2)
Double creates an std::vector which contains img1 and img2; this is for filters input.
Definition: image_vec.hpp:49
The FilterDragoTMO class.
Definition: filter_drago_tmo.hpp:30
FilterDragoTMO flt_drg
Definition: drago_tmo.hpp:38
The Image class stores an image as buffer of float.
Definition: image.hpp:60
The DragoTMO class.
Definition: drago_tmo.hpp:33
PIC_INLINE ImageVec Single(Image *img)
Single creates an std::vector which contains img; this is for filters input.
Definition: image_vec.hpp:36
float Ld_Max
Definition: drago_tmo.hpp:36
Definition: bilateral_separation.hpp:25
FilterLuminance flt_lum
Definition: drago_tmo.hpp:37
void update(float Ld_Max, float b, float Lw_Max, float Lwa)
update
Definition: filter_drago_tmo.hpp:80
Image * ProcessAux(ImageVec imgIn, Image *imgOut)
ProcessAux.
Definition: drago_tmo.hpp:46