18 #ifndef PIC_METRICS_TMQI_HPP 19 #define PIC_METRICS_TMQI_HPP 23 #include "../base.hpp" 24 #include "../image.hpp" 25 #include "../image_vec.hpp" 27 #include "../metrics/base.hpp" 29 #include "../util/indexed_array.hpp" 30 #include "../util/array.hpp" 31 #include "../util/math.hpp" 32 #include "../util/std_util.hpp" 33 #include "../util/tile_list.hpp" 34 #include "../util/string.hpp" 36 #include "../algorithms/pyramid.hpp" 38 #include "../filtering/filter_luminance.hpp" 39 #include "../filtering/filter_gaussian_2d.hpp" 40 #include "../filtering/filter_downsampler_2d.hpp" 41 #include "../filtering/filter_down_pp.hpp" 43 #include "../filtering/filter_tmqi.hpp" 98 int n = int(tl.
size());
99 for(
int i = 0; i < n; i++) {
112 float p_hat[] ={4.4f, 10.1f};
113 float beta_mode = (p_hat[0] - 1.0f) / (p_hat[0] + p_hat[1] - 2.0f);
115 float C_0 =
betaPDF(beta_mode, p_hat[0], p_hat[1]);
116 float C =
betaPDF(sig / 64.29f, p_hat[0], p_hat[1]);
119 float mu_hat = 115.94f;
120 float sigma_hat = 27.99f;
146 Image img12 = (*L_HDR) * (*L_LDR);
151 Image mu12 = (*mu1) * (*mu2);
154 mu2->applyFunction(
square);
179 stdVectorClear<Image>(vec);
197 Image *t_HDR = L_HDR;
198 Image *t_LDR = L_LDR;
199 for(
auto i = 0; i <
weights.size(); i++) {
202 if(t_HDR != NULL && t_LDR != NULL) {
208 int width = t_HDR->
width >> 1;
209 int height = t_HDR->
height >> 1;
243 imgIn[1]->getMaxVal(NULL, &max_img_LDR);
245 if(max_img_LDR <= 1.0f) {
252 float min_L_HDR, max_L_HDR;
259 float scale = (powf(2.0f, 32.0f) - 1.0f) / (max_L_HDR - min_L_HDR);
float invA
Definition: tmqi.hpp:53
PIC_INLINE bool ImageVecCheck(ImageVec &imgIn, int minInputImages)
ImageVecCheck.
Definition: image_vec.hpp:147
float structuralFidelity(Image *L_HDR, Image *L_LDR)
structuralFidelity
Definition: tmqi.hpp:192
int channels
Definition: image.hpp:80
T * delete_s(T *data)
delete_s
Definition: std_util.hpp:123
PIC_INLINE bool ImageVecCheckSimilarType(ImageVec &stack)
ImageVecCheckSimilarType.
Definition: image_vec.hpp:126
TMQI()
TMQI.
Definition: tmqi.hpp:62
Image * execute(ImageVec imgIn, float &Q, float &N, float &S, Image *tmqi_map=NULL)
execute
Definition: tmqi.hpp:230
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
float * getMeanVal(BBox *box, float *ret)
getMeanVal computes the mean for the current Image.
float beta
Definition: tmqi.hpp:53
void update(float sf)
update
Definition: filter_tmqi.hpp:91
FilterGaussian2D flt_gauss2D
Definition: tmqi.hpp:56
FilterLuminance flt_lum
Definition: tmqi.hpp:55
BBox getBBox(int index)
genBBox
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
The FilterLuminance class.
Definition: filter_luminance.hpp:33
float a
Definition: tmqi.hpp:53
float * getMinVal(BBox *box, float *ret)
getMinVal computes the minimum value for the current Image.
The TMQI class.
Definition: tmqi.hpp:50
The FilterTMQI class.
Definition: filter_tmqi.hpp:30
The TileList class.
Definition: tile_list.hpp:33
float alpha
Definition: tmqi.hpp:53
float statisticalNaturalness(Image *L_LDR)
statisticalNaturalness
Definition: tmqi.hpp:82
PIC_INLINE float betaPDF(float x, float A, float B)
betaPDF
Definition: math.hpp:536
Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter_npasses.hpp:310
uint getNext()
getNext returns the index of the next tile to process.
PIC_INLINE float square(float x)
Square applies square function to a value.
Definition: math.hpp:188
void release()
release frees allocated buffers.
void applyFunction(float(*func)(float))
applyFunction is an operator that applies an input function to all values in data.
std::vector< float > weights
Definition: tmqi.hpp:54
static Image * execute(Image *imgIn, Image *imgOut, float scale, ImageSampler *isb=NULL)
execute
Definition: filter_sampler_2d.hpp:149
The Image class stores an image as buffer of float.
Definition: image.hpp:60
float * getMeanVal(BBox *box, float *ret)
getMeanVal computes the mean for the current Image.
Definition: filter_radial_basis_function.hpp:1501
void update(float sigma)
update
Definition: filter_gaussian_2d.hpp:72
PIC_INLINE ImageVec Triple(Image *img1, Image *img2, Image *img3)
Triple creates an std::vector which contains img1, img2, and img3; this is for filters input...
Definition: image_vec.hpp:64
Image * clone() const
Clone creates a deep copy of the calling instance.
PIC_INLINE float sqrtf_s(float x)
sqrtf_s
Definition: math.hpp:198
FilterTMQI flt_tmqi
Definition: tmqi.hpp:57
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
The FilterGaussian2D class.
Definition: filter_gaussian_2d.hpp:31
float * getMaxVal(BBox *box, float *ret)
getMaxVal computes the maximum value for the current Image.
int width
Definition: image.hpp:80
int height
Definition: image.hpp:80
float * getVarianceVal(float *meanVal, BBox *box, float *ret)
getVarianceVal computes the variance for the current Image.
Image * localStructuralFidelity(Image *L_HDR, Image *L_LDR, float sf, float &S, Image *s_map=NULL)
localStructuralFidelity
Definition: tmqi.hpp:138
PIC_INLINE float normalDistribution(float x, float mu=0.0f, float sigma=1.0f)
normalDistribution
Definition: math.hpp:460