Colormap, how to get the color of the sea

15 次查看(过去 30 天)
This is an interesting question to me. I wanted to create a nice colormap with very smooth and gradual transition from white to sea blue. I tried to do it manually in colormap but it does not work out very well. Anybody who has explored this, or know some developed colormap?
Many thanks

采纳的回答

Image Analyst
Image Analyst 2016-12-1
Try a program where you can easily get the RGB values of some color of blue that you like, like (r,g,b) = (rBlue, gBlue, bBlue). Then use linspace().
numColors = 256; % Good value for 24/32 bit displays.
oceanRed = 15;
oceanGreen = 127;
oceanBlue = 230;
myColorMap = [linspace(oceanRed, 255, numColors)'/255,...
linspace(oceanGreen, 255, numColors)'/255,...
linspace(oceanBlue, 255, numColors)'/255]
imshow('cameraman.tif');
colormap(gca, myColorMap);
colorbar
  2 个评论
DGM
DGM 2023-1-3
编辑:DGM 2023-1-3
The variable numColors specifies the number of tuples (rows) in the colormap. It's easy enough to test.
numColors = 5; % change the value and see what happens
oceanRed = 15;
oceanGreen = 127;
oceanBlue = 230;
myColorMap = [linspace(oceanRed, 255, numColors)'/255,...
linspace(oceanGreen, 255, numColors)'/255,...
linspace(oceanBlue, 255, numColors)'/255]
myColorMap = 5×3
0.0588 0.4980 0.9020 0.2941 0.6235 0.9265 0.5294 0.7490 0.9510 0.7647 0.8745 0.9755 1.0000 1.0000 1.0000

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Blue 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by