Mercurial > octave-nkf
diff scripts/image/ind2rgb.m @ 559:4e826edfbc56
[project @ 1994-07-25 22:18:28 by jwe]
Initial revision
author | jwe |
---|---|
date | Mon, 25 Jul 1994 22:19:05 +0000 |
parents | |
children | 3470f1e25a79 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/image/ind2rgb.m Mon Jul 25 22:19:05 1994 +0000 @@ -0,0 +1,29 @@ +function [R G B] = ind2rgb(X,map) +#Convert an indexed image to red, green, and blue color components. +# +#[R G B] = ind2rgb(X) uses the current colormap for the conversion. +# +#[R G B] = ind2rgb(X,map) uses the specified colormap. +# +#SEE ALSO: rgb2ind, image, imshow, ind2gray, gray2ind. + + if(nargin == 1) + map = colormap; + endif + + [hi wi] = size(X); + + pref = do_fortran_indexing; + do_fortran_indexing = "true"; + + R = map(X(:),1); + G = map(X(:),2); + B = map(X(:),3); + + R = reshape(R,hi,wi); + G = reshape(G,hi,wi); + B = reshape(B,hi,wi); + + do_fortran_indexing = pref; + +endfunction