I have this code:
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import FuncionesFiltros as fun
Im = Image.open('build.jpg')
Im_a = np.array(Im)
plt.figure()
plt.imshow(Im_a)
plt.title('IMAGEN ORIGINAL')
plt.axis("off")
Im_cmy = fun.my_cmy2rgb(Im_a)
plt.figure()
plt.imshow(Im_cmy)
plt.title('IMAGEN RGB A CMY')
plt.axis("off")
Im_rgb = fun.my_rgb2cmy(Im_cmy)
plt.figure()
plt.imshow(Im_rgb)
plt.title('IMAGEN CMY A RGB')
plt.axis("off")
Im_hsi = fun.RGB_TO_HSI(Im_rgb)
plt.figure()
plt.imshow(Im_hsi)
plt.title('IMAGEN RGB A HSI')
plt.axis("off")
-This is the function:
def RGB_TO_HSI(R,G,B):
if(0<=R<=255 and 0<=G<=255 and 0<=B<=255):
d = R+G+B
r = float(R)/d
g = float(G)/d
b = float(B)/d
numerador = float( 0.5 * ((r - g) + (r - b)))
denominador = float(((r - g)**(2) + (r - b)*(g - b))**(0.5))
if(b <= g):
h = math.acos(numerador/denominador)
if(b > g):
h = (2*math.pi) - math.acos(numerador/denominador )
s = 1 - (3 * min(r,g,b))
i = float(R+G+B)/float(3*255)
rturn h,s,i
When I compile it, I get an error:
ValueError: not enough values to unpack (expected 3, got 2)
From what I understand it is that 3 values are expected and you just get 2, but I do not know in which part I'm failing. If someone could tell me the error I would appreciate it.
Thanks