If I create the following image, with 3 possible values: 1, 2 and 10.
im = zeros(128,128)
im(1:32,:) = 1
im(33:64,:) = 2
im(65:end,:) = 10
ax = imshow(im,[])
cmap = [0.9020 0.0980 0.2941
0.2353 0.7059 0.2941
0.8000 0.8000 0.8000]
colormap(ax.Parent,cmap)
I obtain an image with only 2 colors, when the colormap has 3 colors. Why isn't the colormap being respected? I want these specific colors for each value of the image. And I want my colormap to include only these colors, no more and no less. And no, my image does not contain values from 3 to 9. It is just 1, 2 and 10 and it is supposed to be like this.
Any help appreciated
André