Image.gamma_encode#
- Image.gamma_encode(gamma: str | float) Self[source]#
Gamma encoding
- Parameters:
gamma (str, float) – gamma value
- Returns:
gamma encoded version of image
- Return type:
Gamma encode the image. This takes a linear luminance image and converts it to a form suitable for display on a non-linear monitor.
gammais either the string ‘sRGB’ for IEC 61966-2-1:1999 or a float:\[\mat{Y}_{u,v} = \mat{X}_{u,v}^\gamma\]Example:
>>> from machinevisiontoolbox import Image >>> img = Image(np.arange(8)[np.newaxis, :]) # create grey step wedge >>> img.gamma_encode('sRGB').disp() <matplotlib.image.AxesImage object at 0x7f076e522390>
Note
gammais the reciprocal of the value used for gamma decodingGamma encoding is typically performed in a camera with \(\gamma=0.45\).
For images with multiple planes, the gamma encoding is applied to all planes.
For floating point images, the pixels are assumed to be in the range 0 to 1.
For integer images,the pixels are assumed in the range 0 to the maximum value of their class. Pixels are converted first to double, processed, then converted back to the integer class.
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 10.2.7, 10.3.6.
- Seealso: