24#ifndef _VIGRA_EXT_HDRUTILS_H
25#define _VIGRA_EXT_HDRUTILS_H
35template<
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>
106 if (
minW > (1.0-eps) &&
maxW > (1.0-eps)) {
109 }
else if (
minW < eps &&
maxW < eps) {
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);
165 std::cerr <<
"w = [";
166 for (
int i=0;
i<256;
i++) {
168 float x = (
i/255.0f - 0.5f)/0.18f;
169 vigra::UInt8
w = std::min(utils::ceili(255*
exp( -x*x)), 255);
174 std::cerr << (
int)
w <<
" ";
179 vigra::UInt8 operator()(vigra::RGBValue<T>
rgb)
const
185 T x = std::max(
rgb[0], std::max(
rgb[1],
rgb[2]));
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;
Traits::RealPromote real_type
VALUETYPE second_argument_type
VALUETYPE first_argument_type
real_type operator()() const
return the result
vigra::NumericTraits< VALUETYPE > Traits
V getMaxComponent(vigra::RGBValue< V > const &v)
get the maximum component of a vector (also works for single pixel types...)
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
functions to manage ROI's