18 #ifndef PIC_TONE_MAPPING_FERWERDA_TMO_HPP 19 #define PIC_TONE_MAPPING_FERWERDA_TMO_HPP 21 #include "../base.hpp" 23 #include "../util/array.hpp" 25 #include "../filtering/filter.hpp" 26 #include "../filtering/filter_luminance.hpp" 27 #include "../tone_mapping/tone_mapping_operator.hpp" 55 images[0]->getMaxVal(NULL, &maxVal);
63 int channels = imgIn[0]->channels;
64 float *scale =
new float[channels];
74 for(
int i = 0; i < channels; i++) {
78 #pragma omp parallel for 79 for(
int i = 0; i < imgIn[0]->size(); i += channels) {
81 int indexL = i / channels;
83 for(
int j = 0; j < channels; j++) {
85 imgOut->
data[index] = imgIn[0]->data[index] * mC +
86 images[0]->data[indexL] * scale[j];
124 this->Ld_a =
Ld_a > 0.0f ?
Ld_a : (this->Ld_Max / 2.0f);
133 static float Ts(
float x)
144 y = powf(0.405f * t + 1.6f, 2.18f) - 2.86f;
158 static float Tp(
float x)
169 y = powf(0.249f * t + 0.65f, 2.7f) - 0.72f;
186 float k = (sigma -
Lw_a / 4.0f) / (sigma +
Lw_a);
187 return (k > 0.0f) ? k : 0.0f;
float Ld_a
Definition: ferwerda_tmo.hpp:37
Image * Process(ImageVec imgIn, Image *imgOut=NULL)
Process.
Definition: tone_mapping_operator.hpp:120
float * data
data is the main buffer where pixel values are stored.
Definition: image.hpp:91
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
ImageVec images
Definition: tone_mapping_operator.hpp:35
float Lw_a
Definition: ferwerda_tmo.hpp:37
static float Tp(float x)
Tp computes the gamma function used in Ferwerda TMO for Photopic levels (cones' cells).
Definition: ferwerda_tmo.hpp:158
FerwerdaTMO(float Ld_Max=100.0f, float Ld_a=50.0f, float Lw_a=50.0f)
FerwerdaTMO.
Definition: ferwerda_tmo.hpp:104
void update(float Ld_Max=100.0f, float Ld_a=50.0f, float Lw_a=50.0f)
update
Definition: ferwerda_tmo.hpp:121
The ToneMappingOperator class.
Definition: tone_mapping_operator.hpp:31
static float WalravenValetonK(float Lw_a, float sigma=100.0f)
WalravenValetonK.
Definition: ferwerda_tmo.hpp:184
Image * ProcessAux(ImageVec imgIn, Image *imgOut)
ProcessAux.
Definition: ferwerda_tmo.hpp:46
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
The FilterLuminance class.
Definition: filter_luminance.hpp:33
FilterLuminance flt_lum
Definition: ferwerda_tmo.hpp:38
void updateImage(Image *imgIn)
updateImage
Definition: tone_mapping_operator.hpp:78
~FerwerdaTMO()
Definition: ferwerda_tmo.hpp:110
void release()
release
Definition: tone_mapping_operator.hpp:68
The FerwerdaTMO class.
Definition: ferwerda_tmo.hpp:34
static float Ts(float x)
Ts computes the gamma function used in Ferwerda TMO for Scotopic levels (rods' cells).
Definition: ferwerda_tmo.hpp:133
static Image * execute(Image *imgIn, Image *imgOut)
execute
Definition: ferwerda_tmo.hpp:196
The Image class stores an image as buffer of float.
Definition: image.hpp:60
float Ld_Max
Definition: ferwerda_tmo.hpp:37
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 T * assign(T *data, int size, T *ret)
assign
Definition: array.hpp:464