From 0533dbfedafdec012d08de41a740ce179dfedacd Mon Sep 17 00:00:00 2001 From: Souriya Trinh Date: Fri, 18 Oct 2024 23:35:11 +0200 Subject: [PATCH] When testing on multiple images, looks like inverse gamma is not needed. --- modules/imgproc/src/vpImgproc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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);