diff --git a/Applications/Utils/otbColorMapping.cxx b/Applications/Utils/otbColorMapping.cxx index 7ee40000b09ac514a3de8b2ae197b48154b651ed..adff0e99af531f5a49898b30a237a751e22a2d92 100644 --- a/Applications/Utils/otbColorMapping.cxx +++ b/Applications/Utils/otbColorMapping.cxx @@ -628,11 +628,11 @@ private: // Convert the radiometric value to [0, 255] // using the clamping from histogram cut - color[RGB] = NumericTraitsType::Clamp( meanValue[dispIndex] - , minVal[dispIndex] - , maxVal[dispIndex] ) - / (maxVal[dispIndex] - minVal[dispIndex]) - * 255.0; + color[RGB] = NumericTraitsType::Clamp( (meanValue[dispIndex] - minVal[dispIndex]) + / (maxVal[dispIndex] - minVal[dispIndex]) + * 255.0 + , 0.0 + , 255.0); } } otbAppLogINFO("Adding color mapping " << clabel << " -> [" << (int) color[0] << " " << (int) color[1] << " "<< (int) color[2] << " ]" << std::endl);