フィルターのクリア

Save pixel color value for indexed image (without image Processing Toolobx)

1 回表示 (過去 30 日間)
Matteo Niccoli
Matteo Niccoli 2012 年 2 月 8 日
編集済み: Een Qurota Aini 2013 年 10 月 7 日
With reference to Steve Eddins blog post on pixel colors: http://blogs.mathworks.com/steve/2006/02/10/all-about-pixel-colors-part-3/
Suppose I create his same image: A = magic(5);
Then I display it with imagesc and colormap HSV: imagesc(A); colormap(hsv);
Is there any way now (without using Image processing Toolbox) to save to a matrix the R,G,B triplets corresponding to the colors of each pixel as produced using HSV?
Thanks, Matteo
  1 件のコメント
Matteo Niccoli
Matteo Niccoli 2012 年 2 月 8 日
Thanks Walter and Sean.
It will take me some time but i will try both suggestions and then will comment on results.
Matteo

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

採用された回答

Walter Roberson
Walter Roberson 2012 年 2 月 8 日
apply that routine and then get() the CData property and that will be the RGB.
  6 件のコメント
Matteo Niccoli
Matteo Niccoli 2012 年 3 月 12 日
Sorry, it took me a bit to get back to this.
The example in my original question was a simple one, and with a reference to Steve's blog, so it was perfect to explain what I wanted to do (I often tent to be a bit vague, typical of non native speakers).
Sean, usually my images would have more than 256 elements, so I will have to look into the suggested method more carefully as I'm not familiar with either histc or numel.
With one of the maps I had in mind I was trying to get to the RGB colors after the application of an overlay with alpha as in this other post by Steve: http://blogs.mathworks.com/steve/2009/02/18/image-overlay-using-transparency/ . Walter's idea of using freezeColors worked in that case too, with a slight adaptation. I'm about to post an example on my blog and I will acknowledge the answer, then post it on this thread.
Matteo Niccoli
Matteo Niccoli 2012 年 4 月 9 日
Hi Walter
Here's my blog post showing what I am doing (I used your suggestion and applied to color with shading)
http://mycarta.wordpress.com/2012/04/05/visualization-tips-for-geoscientists-matlab-part-ii/
Thanks again. And thanks to Sean as well.
Matteo

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

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 2 月 8 日
Something like:
A = magic(5);
imagesc(A);
map = hsv;
colormap(map);
Av = A(:);
[~, bin] = histc(Av,linspace(min(Av),max(Av),min(numel(Av),size(map,1))));
mapp = permute(map,[1 3 2]);
rgb = reshape(mapp(bin,:,:),size(A,1),size(A,2),3);
maybe?
  3 件のコメント
Sean de Wolski
Sean de Wolski 2012 年 2 月 9 日
You missed a closing ')' on that line - just like the error message says.
Just copy and paste it.
Matteo Niccoli
Matteo Niccoli 2012 年 3 月 12 日
I'll check it out, thank you Sean.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by