losing CData after replotting image in subplot ?

1 回表示 (過去 30 日間)
LO
LO 2021 年 3 月 6 日
コメント済み: LO 2021 年 3 月 7 日
I am making a montage of image panels, which look like BW but are not binary.
I am then taking the CData of the montage and , using imagesc, I would like to recolorize my image
so I set the proper x,y size (obtained from montage object) and add the montage CData info.
in a new figure I obtain the desired colored montage. In the same subplot panel no. Even after clearing or removing the montage.
why is that ?
adding a color map makes the image binary. I add the line just for testing
mo=montage(tN,'size',[2,4]);
cdata = mo.CData;,cla(ax325)
ax325=subplot(3,2,5);
imagesc(2560,1280,cdata);
colormap parula
  1 件のコメント
Image Analyst
Image Analyst 2021 年 3 月 6 日
Attach tN in a .mat file.

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

採用された回答

Walter Roberson
Walter Roberson 2021 年 3 月 6 日
By default, colormap() applies to the whole figure. You can make it apply to a specific axes by passing the handle of the axes.
When you ask for the cdata property of an image that has been colorized using colormap, you get the data that is held in the object, not the colorized version of the data.
The easiest way to extract the rgb being displayed by a colormapped object is to use the File Exchange contribution freezecolors() and then extract the cdata.
  1 件のコメント
LO
LO 2021 年 3 月 7 日
thanks Walter, the function you suggested indeed allows me to use different color mapping but somehow I lose the information of the CData.
Without freezeColor I can replot on a new figure a RGB color map of what I need (still in the subplot is BW).
with the freezeColor function the map can be colored differently but somehow it loses depth (it looks binary, although colored in blue/yellow, when using the "parula" colormap, for instance).

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBlue についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by