machinevisiontoolbox.Image.gamma_encode
- Image.gamma_encode(gamma)
Gamma encoding
- Parameters:
gamma (str, float) – gamma value
- Returns:
gamma encoded version of image
- Return type:
Image
Gamma encode the image. This takes a linear luminance image and converts it to a form suitable for display on a non-linear monitor.
gamma
is 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 0x7f2acbd35280>
- Note:
gamma
is 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:
Robotics, Vision & Control for Python, Section 10.2.7, 10.3.6, P. Corke, Springer 2023.
- Seealso: