Colormap, how to get the color of the sea

12 visualizaciones (últimos 30 días)
Xin
Xin el 1 de Dic. de 2016
Editada: DGM el 3 de En. de 2023
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

Respuesta aceptada

Image Analyst
Image Analyst el 1 de Dic. de 2016
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 comentarios
noor
noor el 3 de En. de 2023
what does the function numColors do?
DGM
DGM el 3 de En. de 2023
Editada: DGM el 3 de En. de 2023
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Blue en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by