21 #ifndef otbReliefColormapFunctor_hxx
22 #define otbReliefColormapFunctor_hxx
32 template <
class TScalar,
class TRGBPixel>
36 float m_Borders[] = {0.0f, 0.00001f, 0.2f, 0.43f, 0.71f, 1.0f};
37 float m_RedValues[] = {0.75f, 0.64f, 0.47f, 0.89f, 0.58f, 1.0f};
38 float m_GreenValues[] = {0.91f, 0.84f, 0.76f, 0.90f, 0.32f, 1.0f};
39 float m_BlueValues[] = {0.96f, 0.59f, 0.40f, 0.57f, 0.00f, 1.0f};
42 RealType value = this->RescaleInputValue(v);
45 while (value > m_Borders[i])
48 float factor = (value - m_Borders[i - 1]) / (m_Borders[i] - m_Borders[i - 1]);
51 RealType red = m_RedValues[i - 1] + factor * (m_RedValues[i] - m_RedValues[i - 1]);
53 RealType green = m_GreenValues[i - 1] + factor * (m_GreenValues[i] - m_GreenValues[i - 1]);
55 RealType blue = m_BlueValues[i - 1] + factor * (m_BlueValues[i] - m_BlueValues[i - 1]);
58 red = vnl_math_max(0.0, red);
59 red = vnl_math_min(1.0, red);
61 green = vnl_math_max(0.0, green);
62 green = vnl_math_min(1.0, green);
64 blue = vnl_math_max(0.0, blue);
65 blue = vnl_math_min(1.0, blue);
70 pixel[0] = this->RescaleRGBComponentValue(red);
71 pixel[1] = this->RescaleRGBComponentValue(green);
72 pixel[2] = this->RescaleRGBComponentValue(blue);