Creating a custom perceptually uniform colormap
3 views (last 30 days)
Show older comments
Hello community,
as a little exercise for myself, and for use in future reports, I am currently attempting to write my own MATLAB script, which will - hopefully - create a perceptually uniform colormap, i.e. a colormap that retains its information even when printed in grayscales.
My first attempt was to simply create a simple RGB color gradient, sequentially using all pairs of the three colors (red and green, green and blue, blue and red) to create a basic, raw colormap.
In order to make it perceptually uniform, I then proceeded to to scale the brightness of the resulting colors: [0 0 0] returns black, [1 1 1] returns white, and all intermediate, homogenous values return some shade of gray. I thus applied a simple weighting scheme, and reduced or increased the brightness of my raw colors, so that the average value of my (now adjusted) colors matches any desired value in my brightness interval between 0 and 1.
When desaturating the image in GIMP, however, it turned out that my raw colormap did not have a uniform brightness, and nor did my brightness-adjusted colormap, even though the average RGB corresponding to a linear grayscale value was preserved.
I want to achieve a smooth, linear, desaturated brightness-curve. When using a custom grayscale colormap [a a a] with 0 <= a <= 1, a linear brightness curve can be achieved. Do you know what I am missing? How can I correct my approach?
Best regards, Max
P.S.: Below is the example of my colormap, on the left the raw colormap (mean RGB value for all colors: 0.33), right the brightness-adjusted colormap (between 0.2 and 0.8), and their desaturated counterparts.

1 Comment
Alexandra Harkai
on 31 Oct 2016
I'm assuming a grayscale colormap is not an option. :) I like the question a lot, don't have an answer though.
These seemed to be helpful, they suggest the RGB values get weighed differently:
Answers (0)
See Also
Categories
Find more on Color and Styling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!