Save pixel color value for indexed image (without image Processing Toolobx)
Show older comments
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 Comment
Matteo Niccoli
on 8 Feb 2012
Accepted Answer
More Answers (1)
Sean de Wolski
on 8 Feb 2012
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 Comments
Matteo Niccoli
on 9 Feb 2012
Sean de Wolski
on 9 Feb 2012
You missed a closing ')' on that line - just like the error message says.
Just copy and paste it.
Matteo Niccoli
on 12 Mar 2012
Categories
Find more on White in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!