W3cubDocs

/TensorFlow 1.15

tf.image.adjust_gamma

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.

Args
image RGB image or images to adjust.
gamma A scalar or tensor. Non negative real number.
gain A scalar or tensor. The constant multiplier.
Returns
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)
Raises
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

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/image/adjust_gamma