24 #ifndef _VIGRA_EXT_HDRUTILS_H
25 #define _VIGRA_EXT_HDRUTILS_H
35 template<
class VALUETYPE=vigra::RGBValue<
float> >
44 typedef typename vigra::NumericTraits<VALUETYPE>
Traits;
54 result = vigra::NumericTraits<real_type>::zero();
64 template<
class T,
class M>
74 double w = 0.5-fabs(nm-0.5);
106 if (
minW > (1.0-eps) &&
maxW > (1.0-eps)) {
109 }
else if (
minW < eps &&
maxW < eps) {
139 double calcSigmoidHDRWeight(In val)
148 double y = 1.0 / ( 1.0 + exp(-x));
150 double min = 1.0 / ( 1.0 + exp(+6.0));
151 double max = 1.0 / ( 1.0 + exp(-6.0));
152 return (y - min)/(max-
min);
160 struct HDRWeightFunctor
165 std::cerr <<
"w = [";
166 for (
int i=0;i<256;i++) {
168 float x = (i/255.0f - 0.5f)/0.18f;
174 std::cerr << (int) w <<
" ";
179 vigra::UInt8 operator()(vigra::RGBValue<T> rgb)
const
186 return operator()(x);
189 vigra::UInt8 operator()(
float x)
const
194 i = (vigra::UInt8) x;
199 vigra::UInt8 operator()(vigra::UInt16 x)
const
205 vigra::UInt8 operator()(vigra::UInt8 x)
const
210 vigra::ArrayVector<vigra::UInt8> m_lut;
V getMaxComponent(vigra::RGBValue< V > const &v)
get the maximum component of a vector (also works for single pixel types...)
Traits::RealPromote real_type
vigra::NumericTraits< VALUETYPE > Traits
functions to manage ROI's
VALUETYPE first_argument_type
real_type operator()() const
return the result
VALUETYPE second_argument_type