tf.image.adjust_gamma

TensorFlow 2 version View source on GitHub

Performs Gamma Correction on the input image.

Also known as Power Law Transform. This function converts the input images at first to float representation, then transforms them pixelwise according to the equation Out = gain * In**gamma, and then converts the back to the original data type.

image RGB image or images to adjust.
gamma A scalar or tensor. Non negative real number.
gain A scalar or tensor. The constant multiplier.

A Tensor. A Gamma-adjusted tensor of the same shape and type as image.

Usage Example:

>> import tensorflow as tf
>> x = tf.random.normal(shape=(256, 256, 3))
>> tf.image.adjust_gamma(x, 0.2)

ValueError If gamma is negative.

Notes:

For gamma greater than 1, the histogram will shift towards left and the output image will be darker than the input image. For gamma less than 1, the histogram will shift towards right and the output image will be brighter than the input image.

References:

[1] http://en.wikipedia.org/wiki/Gamma_correction