18 #ifndef PIC_TONE_MAPPING_GET_ALL_EXPOSURES_HPP 19 #define PIC_TONE_MAPPING_GET_ALL_EXPOSURES_HPP 21 #include "../base.hpp" 22 #include "../image.hpp" 23 #include "../histogram.hpp" 25 #include "../util/math.hpp" 26 #include "../util/indexed_array.hpp" 28 #include "../filtering/filter_luminance.hpp" 29 #include "../filtering/filter_simple_tmo.hpp" 45 Image *img_lum = NULL;
61 float tminFstop =
log2f(commonMin);
62 float tmaxFstop =
log2f(commonMax);
64 minFstop = int(
lround(tminFstop));
65 maxFstop = int(
lround(tmaxFstop));
67 int halfFstops = (maxFstop - minFstop + 1) >> 1;
68 minFstop = -halfFstops + 1;
69 maxFstop = halfFstops - 1;
71 if(minFstop == maxFstop) {
89 std::vector<float> ret;
94 for(
int i = iMin; i <= iMax; i++) {
95 ret.push_back(
float(i));
108 std::vector<float> fstops;
151 for(
unsigned int i = 0; i < fstops.size(); i++) {
152 flt.
update(gamma, fstops[i]);
155 expo->
exposure = powf(2.0f, fstops[i]);
156 expo->
clamp(0.0f, 1.0f);
Definition: filter_luminance.hpp:28
float * data
data is the main buffer where pixel values are stored.
Definition: image.hpp:91
int channels
Definition: image.hpp:80
void clamp(float a, float b)
clamp set data values in the range [a,b]
std::vector< Image * > ImageVec
ImageVec an std::vector of pic::Image.
Definition: image_vec.hpp:29
The Histogram class is a class for creating, managing, loading, and saving histogram for an Image...
Definition: histogram.hpp:37
PIC_INLINE long lround(double x)
lround rounds double numbers properly.
Definition: math.hpp:229
Definition: histogram.hpp:31
virtual Image * Process(ImageVec imgIn, Image *imgOut)
Process.
Definition: filter.hpp:390
The FilterSimpleTMO class.
Definition: filter_simple_tmo.hpp:28
static T max(T *data, IntCoord &coord)
max computes the max value.
Definition: indexed_array.hpp:158
static void findSimple(T *data, int nData, bool(*func)(float), IntCoord &ret, int stride=1)
findSimple collects coordinates of data which satisfies a bool function func.
Definition: indexed_array.hpp:80
static T min(T *data, IntCoord &coord)
min computes the min value.
Definition: indexed_array.hpp:136
float exposure
Definition: image.hpp:79
std::vector< int > IntCoord
IntCoord.
Definition: indexed_array.hpp:30
static Image * execute(Image *imgIn, Image *imgOut, LUMINANCE_TYPE type=LT_CIE_LUMINANCE)
execute
Definition: filter_luminance.hpp:166
void update(float gamma, float fstop)
update
Definition: filter_simple_tmo.hpp:62
PIC_INLINE void getMinMaxFstops(Image *imgIn, int &minFstop, int &maxFstop)
getMinMaxFstops computes the minimum and maximum f-stop values of an image.
Definition: get_all_exposures.hpp:39
PIC_INLINE std::vector< float > getAllExposures(Image *imgIn)
getAllExposures computes all required exposure values for reconstructing the input image using histog...
Definition: get_all_exposures.hpp:107
#define PIC_INLINE
Definition: base.hpp:33
std::vector< float > exposureCovering(int nBits=8, float overlap=1.0f)
exposureCovering computes the exposure values for fully covering the dynamic range of the image...
Definition: histogram.hpp:585
PIC_INLINE float log2f(float x)
log2f logarithm in base 2 for floating point
Definition: math.hpp:375
The Image class stores an image as buffer of float.
Definition: image.hpp:60
The IndexedArray class.
Definition: indexed_array.hpp:36
PIC_INLINE ImageVec getAllExposuresImages(Image *imgIn, std::vector< float > &fstops, float gamma=2.2f)
getAllExposuresImages converts an image into a stack of images.
Definition: get_all_exposures.hpp:144
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
bool isValid()
isValid checks if the current image is valid, which means if they have an allocated buffer or not...
int width
Definition: image.hpp:80
int height
Definition: image.hpp:80
PIC_INLINE std::vector< float > getAllExposuresUniform(Image *imgIn)
getAllExposuresUniform computes all required exposure values for reconstructing the input image using...
Definition: get_all_exposures.hpp:87