diff --git a/modules/imgproc/src/vpImgproc.cpp b/modules/imgproc/src/vpImgproc.cpp index f6f092d0eb..8e74f2ca23 100644 --- a/modules/imgproc/src/vpImgproc.cpp +++ b/modules/imgproc/src/vpImgproc.cpp @@ -329,13 +329,12 @@ void gammaCorrectionLogMethod(vpImage &I, const vpImage *p_ unsigned char inputRange = inputMax - inputMin; float gamma_computed = static_cast((std::log(128.f) - std::log(256.f)) / (std::log(mean) - std::log(inputRange))); - float inverse_gamma = 1.f / gamma_computed; // Construct the look-up table unsigned char lut[256]; float inputRangeAsFloat = static_cast(inputRange); for (unsigned int i = inputMin; i <= inputMax; ++i) { - lut[i] = vpMath::saturate(std::pow(static_cast(i - inputMin) / inputRangeAsFloat, inverse_gamma) * 255.f); + lut[i] = vpMath::saturate(std::pow(static_cast(i - inputMin) / inputRangeAsFloat, gamma_computed) * 255.f); } I.performLut(lut);