Colormap function is not working (color does not change)

Hello everyone,
Since I updated my Matlab version from 2015a to 2016b, the colormap function does not make any change to my images as they are still shown in their original grey and white color. It was not like this in version 2015a. I would appreciate it if someone could help me. Thanks

5 件のコメント

Marc Jakobi
Marc Jakobi 2016 年 10 月 25 日
The description of your problem is too vague, since not many people will have encountered it. Could you please add more details, maybe some example code that lets us reproduce your issue?
Nguyen Huudat
Nguyen Huudat 2016 年 10 月 26 日
you should use the right expression of colormap function. Ex: colormap([1 1 1]) is black-white color. But it doesn't affect to an image because the image has already brought it's color.
Fardin Azimi
Fardin Azimi 2016 年 10 月 26 日
Marc Jakobi Ok. I have some grey and white images which I like to make colorful for visualization purposes. The function 'colormap' does not make any change to my images, unlike in version 2015a. This is the code:
pathname_CT = uigetdir('...');
X_CT = dir(fullfile(pathname_CT,'*.ima'));
dicomfiles_CT = {X_CT.name}; crop_dim = [220 45 287-220 466-45]; CT_Scan1 = cell(12,1);
for i=1:12 name_CT = char(dicomfiles_CT(i)); A=dicomread([pathname_CT '\' name_CT]); CT_Scan1{i}=imcrop(A,crop_dim); end figure(1) imshow(CT_Scan1{1}); colormap(jet); imcontrast;
Fardin Azimi
Fardin Azimi 2016 年 10 月 26 日
Nguyen Huudat Yes my images are originally grey and white but they should become colorful with this function.
Fardin Azimi
Fardin Azimi 2016 年 10 月 26 日
Consider that they are CT scan images, not plots

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2016 年 10 月 26 日

1 投票

You need to pass the axes handle in explicitly starting with R2016b otherwise it won't change. For example
colormap(handles.axes1, myColorMap);

4 件のコメント

Fardin Azimi
Fardin Azimi 2016 年 10 月 26 日
My images are CT scan images, not plots. What is the axis in this case?
Image Analyst
Image Analyst 2016 年 10 月 26 日
What is the name ("tag") of the control on your GUI that you are displaying your image in? How are you displaying it? If you want to apply it to the last axes you showed any image in, try this:
colormap(gca, myColorMap);
AK19
AK19 2017 年 7 月 28 日
Doesn't work on 2017a.
Adam
Adam 2017 年 7 月 28 日
It works fine in R2017a

サインインしてコメントする。

Jan
Jan 2017 年 7 月 28 日

1 投票

figure(1)
AxesH = axes;
imshow(CT_Scan1{1}, 'Parent', AxesH);
colormap(AxesH, jet);
Note than imshow accepts the argument 'Colormap' directly also.

カテゴリ

質問済み:

2016 年 10 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by