I want to create a color spectrum of constant perceived luminance.
This is my attempt so far (here's the codesandbox):
The code
As I annotated in the image, the second stripe from the bottom has a rather bright blue if you ask me though. Now that could be because
I think it's more likely I've made some mistake or haven't understood something here.
I tweaked the sRGB luminance values slightly to get the bottom stripe that is on the verge of being what I would expect (perhaps still a bit bright that blue though).
So my question:
RGB colourspaces are not perceptually uniform spaces. Generating a perceptually uniform hue stripe requires using a perceptually uniform colourspace or colour appearance model such as ICtCp or CAM16.
With Colour, it could be achieved as follows:
import colour
import numpy as np
def colour_stripe(S=1, samples=360):
H = np.linspace(0, 1, samples)
HSV = colour.utilities.tstack([H, np.ones(samples) * S, np.ones(samples)])
RGB = colour.HSV_to_RGB(HSV)
return RGB[np.newaxis, ...]
RGB = np.resize(colour_stripe(), [36, 360, 3])
colour.plotting.plot_image(colour.cctf_encoding(RGB * 0.5));
CAM16 = colour.convert(RGB, 'RGB', 'CAM16')
CAM16_UL = colour.CAM16_Specification(
np.full(CAM16.J.shape, 0.5), CAM16.C, CAM16.h)
RGB_PU = colour.convert(CAM16_UL, 'CAM16', 'RGB')
colour.plotting.plot_image(colour.cctf_encoding(RGB_PU));
Keep in mind that the assumptions here are sRGB display calibration and viewing conditions.