PICCANTE  0.4
The hottest HDR imaging library!
saturation.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_COLORS_SATURATION_HPP
19 #define PIC_COLORS_SATURATION_HPP
20 
21 namespace pic {
22 
23 #include "../base.hpp"
24 #include "../util/math.hpp"
25 #include "../util/array.hpp"
26 
33 PIC_INLINE float computeSaturation(float *data, int channels = 3)
34 {
35  if(channels > 1) {
36  return sqrtf_s(Arrayf::getVariance(data, channels));
37  } else {
38  return 0.0f;
39  }
40 }
41 
42 } // end namespace pic
43 
44 #endif /* PIC_COLORS_SATURATION_HPP */
PIC_INLINE float computeSaturation(float *data, int channels=3)
computeSaturation
Definition: saturation.hpp:33
#define PIC_INLINE
Definition: base.hpp:33
static T getVariance(T *data, int size)
getVariance
Definition: array.hpp:390
PIC_INLINE float sqrtf_s(float x)
sqrtf_s
Definition: math.hpp:198
Definition: bilateral_separation.hpp:25