Skip to content

Commit 0533dbf

Browse files
committed
When testing on multiple images, looks like inverse gamma is not needed.
1 parent 6db5198 commit 0533dbf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

modules/imgproc/src/vpImgproc.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,12 @@ void gammaCorrectionLogMethod(vpImage<unsigned char> &I, const vpImage<bool> *p_
329329
unsigned char inputRange = inputMax - inputMin;
330330

331331
float gamma_computed = static_cast<float>((std::log(128.f) - std::log(256.f)) / (std::log(mean) - std::log(inputRange)));
332-
float inverse_gamma = 1.f / gamma_computed;
333332

334333
// Construct the look-up table
335334
unsigned char lut[256];
336335
float inputRangeAsFloat = static_cast<float>(inputRange);
337336
for (unsigned int i = inputMin; i <= inputMax; ++i) {
338-
lut[i] = vpMath::saturate<unsigned char>(std::pow(static_cast<float>(i - inputMin) / inputRangeAsFloat, inverse_gamma) * 255.f);
337+
lut[i] = vpMath::saturate<unsigned char>(std::pow(static_cast<float>(i - inputMin) / inputRangeAsFloat, gamma_computed) * 255.f);
339338
}
340339

341340
I.performLut(lut);

0 commit comments

Comments
 (0)