skimage2.exposure.adjust_gamma#
- skimage2.exposure.adjust_gamma(image, gamma=1, gain=1)[source]#
Perform gamma correction on the input image.
Gamma correction is a power-law transform [1]. This function transforms the input
imagepixel-wise according to the power lawimage**gammaafter scaling each pixel to the range 0 to 1. Then it is rescaled to its original range and muliplied bygain.- Parameters:
- imagendarray
Input image.
- gammafloat, optional
Non negative real number. Default value is 1.
- gainfloat, optional
The constant multiplier. Default value is 1.
- Returns:
- outndarray
Gamma corrected output image.
See also
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
Examples
>>> import _skimage2 as ski2 >>> image = ski2.util.img_as_float(ski2.data.moon()) >>> gamma_corrected = ski2.exposure.adjust_gamma(image, 2) >>> # Output is darker for gamma > 1 >>> image.mean() > gamma_corrected.mean() True