Save pixel color value for indexed image (without image Processing Toolobx)
Ältere Kommentare anzeigen
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 Kommentar
Matteo Niccoli
am 8 Feb. 2012
Akzeptierte Antwort
Weitere Antworten (1)
Sean de Wolski
am 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 Kommentare
Matteo Niccoli
am 9 Feb. 2012
Sean de Wolski
am 9 Feb. 2012
You missed a closing ')' on that line - just like the error message says.
Just copy and paste it.
Matteo Niccoli
am 12 Mär. 2012
Kategorien
Mehr zu Images finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!