(1)默认的一些颜色映射
matlab colormap
https://blog.csdn.net/qq_20823641/article/details/51711618
(2)使用colormapeditor工具进行修改
(1)
clear all; clc;
% 读取影像
filename1 = 'a.tif';
filename2 = 'b.tif';
img1 = geotiffread(filename1);
img2 = geotiffread(filename2);
(2)
%% 编辑colormap
figure(1)
colormap jet
colormapeditor
imagesc(img)
(3)
%% 保存colormap,并在第二张图像上使用
% gca表示当前的图,因为现在matlab中的colormap不再与figure关联,而是和axes关联,因此要使用mycmap =
% colormap(gca),而不是 mycmap = get(figure(1),'Colormap');
mycmap = colormap(gca);
save('MyColormaps','mycmap');
load('MyColormaps','mycmap');
figure(2)
set(figure(2),'Colormap',mycmap);
imagesc(img_R);
(4)
%%
load('MyColormaps','mycmap');
figure(1)
set(figure(1),'Colormap',mycmap);
imagesc(img1)
figure(2)
set(figure(2),'Colormap',mycmap);
imagesc(img2)
分节运行
首先运行第一节:读取影像
运行第二节:使用colormapeditor工具,在默认colormap基础上编辑修改
然后运行第三节:读取并保存mycmap,并在第二张图像上使用
保存mycmap以后,再次使用mycmap只需运行(1)(4)节,设定修改后的colormap