Apply colormap and caxis directly to image matrix

1 次查看(过去 30 天)
Hello,
I have and image and a colormap, that I usually apply like this:
my_colormap = ....;
my_image = imread(....);
figure(1);
imshow(my_image);
colormap(my_colormap);
caxis([minVal maxVal]);
What I'd like to do is, instead of applying the colormap and the caxis to the figure, I'd like to apply it directly to the image matrix (my_image) for further processing.
At the moment, this is what I tried:
(IMPORTANT: my_image is actually a matrix with double values, also negative values. I figured that when I do imshow, it gets converted to 8 bits or 16 bits uint. I verified this by using im2uint16 to my image and then using imwrite and opening that image with an image viewer. It indeed look the same as the one in the figure).
my_colormap = ....;
% this is a 64 bits values with sign
my_image = imread(....);
% This works and the image looks the same as just doing imshow(my_image)
my_image = im2uint16(my_image);
% This does not work, when I show my_image it looks different than just applying colormap(my_colormap) to a figure
my_image = ind2rgb(my_image, SigColourMap);
% ?? caxis: I still do not know what to do to the matrix to apply the caxis
Any help?
Kind regards

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 White 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by