I'm looking for a way to transform different RGB values of a color gradient into single values ranging from 0 to 1 in python. My current approach is transforming the RGB values into single greyscale values and then scaling those values, but I'm aware that some data information gets lost in this process. So I was wondering if any of you could suggest a way to directly translate RGB values into single values and then scaling those.
I'm doing this because I'm currently training CNNs on colored images generated with matplotlib. pyplot using matshow and a color bar. The images I'm using look somewhat like this:
gramian angular field of sinusoidal data
They are generated by transforming a 1-dimensional array of values ranging from 0 to 1 into a Gramian angular field.
Looking forward to any suggestions! Cheers!