You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 12, 2023. It is now read-only.
When I run the RGB to Lab conversion below (it is the same as the one I showed you in my previous request, but this time on a 256x3 array), it works wonderfully.
LAB=[]
for rgb_val in RGB255:
rgb_r, rgb_g, rgb_b = rgb_val
rgb_color = RGBColor(rgb_r, rgb_g, rgb_b)
lab_color = rgb_color.convert_to('lab')
LAB.append(lab_color.get_value_tuple())
Now I am trying to convert a 256x3 Lab array to RGB. This is my Lab array (essentially a sigmoid function going from black to white):
x = np.linspace(0,10,256)
L=1/(1+np.exp(-(x-5)/1))
a=np.zeros(256)
b=np.zeros(256)
I use this code below.
from colormath.color_objects import LabColor
from colormath.color_objects import RGBColor
RGB=[]
for Lab_val in Lab:
Lab_l, Lab_a, Lab_b = Lab_val
lab = LabColor(Lab_l, Lab_a, Lab_b)
rgb=lab_color.convert_to('rgb')
RGB.append(rgb.get_value_tuple())
As far I can tell this snippet should work, but when I look at the output RGB, it is made of all zeros.
I use colormath in Enthought Canopy so I am still running version 1.0.8
Do you see anything I am missing?