I have the following exercise:
a. Write a function that implements the gamma transformation of a grayscale image. The function must receive as input parameters: a grayscale image (uint8) and the parameter gamma. The output parameter of the function must be a grayscale image (uint8). For Υ avoid losing precision in the calculation of gray level values, convert the image to double before calculating the gamma transformation. The image must be converted back to uint8 before return from the function.
b. Select a color image and apply gamma transformation for Y = 0.05, 0.10, 0.20, 0.50, 1, 1.5.2.5, 5.0, 10.0, 25.0.
This is a point of the Artificial Vision workshop, what happens is that I can see the image in the terminal, but I need the image to be saved on my PC and I do not know why it does not save me.
This way I have the code but I do not know what I would miss, or in what error:
from PIL import Image, ImageOps #importe de libreria PIL
import numpy as np #importe de libreria numpy
import matplotlib.pyplot as plt #importe de libreria matplotlib
import sys #improte de libreria SYS
sys.path.append('D:\Vision') #la ruta de los archivos USB
import tranformacion_lineal as trans
Im_g = Image.open('bears.jpg').convert('L')
Im_ga = np.double(np.array(Im_g)) #Transofrmacion de la imagen a DOUBLE
Im2 = trans.my_gamma( Im_ga, 0.05) #Aca se manda la imagen y el valor para el exponente al metodo para Y=0.05, 0.10, 0.20, 0.50, 1, 1.5,2.5, 5.0, 10.0, 25.0.
plt.gray()
plt.imshow(np.uint8(Im_ga)) # esta linea no es necesaria ya se esta transformado en my_gamma
plt.axis('off')
plt.figure()
plt.gray()
plt.imshow(Im2)
plt.axis('off')
Im_g = Image.save('D:\Vision')