returning the indexes of an image displayed with a specific colormap
2 ビュー (過去 30 日間)
古いコメントを表示
hi, does anyone know hot to get the numeric indexes of a displayed image with a specific user defined colormap???
for example imagesc(IMAGE) colormap(user_colormap)
displays an image mapped into the colormap....and I want the numeric representation of the displayed image.
5 件のコメント
Sean de Wolski
2012 年 8 月 14 日
That's what IMAGE is.... It's just a 2d matrix of indices into the colormap.
採用された回答
Matt Fig
2012 年 8 月 14 日
編集済み: Matt Fig
2012 年 8 月 14 日
If I understand you correctly, you want (for example):
A = rand(4);
C = [0 0 0;.5 .5 .5;1 1 1];
imagesc(A);
colormap(C);
% idx = interp1([0 .5 1],[0 .5 1],A,'nearest')
idx = ceil(A*size(C,1))
7 件のコメント
Matt Fig
2012 年 8 月 14 日
I don't know what you mean by holding with zeros. But the reshape function does pretty much what the name indicates. Take a look:
X = [1 0 2 0 3 0 4 0 5 0 6 0]
reshape(X,4,3)
reshape(X,3,4)
reshape(X,6,2)
reshape(X,2,6)
reshape(X,12,1)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Blue についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!