Image 如果调色板不同,则映射的imshow在子批次中不起作用
我发现显然,映射版本的函数在子批中不起作用。这是故意的吗 下面的脚本Image 如果调色板不同,则映射的imshow在子批次中不起作用,image,matlab,matlab-figure,color-mapping,Image,Matlab,Matlab Figure,Color Mapping,我发现显然,映射版本的函数在子批中不起作用。这是故意的吗 下面的脚本 rgb=imread('../FruitSample_small.png'); [ind,map]=rgb2ind(rgb,4); figure imshow(ind,map) figure subplot(5,1,1); imshow(ind,map) subplot(5,1,2); imshow(ind==0) subplot(5,1,3); imshow(ind==1) subplot(5,1,4); imshow(in
rgb=imread('../FruitSample_small.png');
[ind,map]=rgb2ind(rgb,4);
figure
imshow(ind,map)
figure
subplot(5,1,1);
imshow(ind,map)
subplot(5,1,2);
imshow(ind==0)
subplot(5,1,3);
imshow(ind==1)
subplot(5,1,4);
imshow(ind==2)
subplot(5,1,5);
imshow(ind==3)
生成以下结果
i、 e.映射版本看起来是黑色的。如果我只打印映射版本(5次),它看起来是正常的。即,后续打印显然会更改调色板
那么,如何在同一个图形上绘制所有这5幅图像呢?
Colormap
是图形的属性,而不是轴。第二次调用imshow重置整个图形的Colormap
。如果您下载了该链接中描述的函数,freezeColors
,您可以在代码中这样使用它
rgb=imread('peppers.png'); % example image included in matlab
[ind,map]=rgb2ind(rgb,4);
figure
imshow(ind,map)
figure
subplot(5,1,1);
imshow(ind,map)
freezeColors % keep colors the same after other subplots are displayed
subplot(5,1,2);
imshow(ind==0)
freezeColors
subplot(5,1,3);
imshow(ind==1)
subplot(5,1,4);
imshow(ind==2)
subplot(5,1,5);
imshow(ind==3)
由此产生的第二个图形如下所示: