Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 如果调色板不同,则映射的imshow在子批次中不起作用_Image_Matlab_Matlab Figure_Color Mapping - Fatal编程技术网

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)
由此产生的第二个图形如下所示: