Numpy implementation for converting RGB to HCY and HCY to RGB
Mathis Petrovich
Import the functions
fromhcyimportrgb2hcy, hcy2rgbLoad an image (pixels have to be between 0 and 1)
importimageioimg=imageio.imread("lena.png") /255.Convert the image
hcy_img=rgb2hcy(img)
oimg=hcy2rgb(hcy_img)
assertnp.max(np.abs(oimg-img)) <10**(-13)