559
|
1 function [R G B] = ind2rgb(X,map) |
904
|
2 |
|
3 # Convert an indexed image to red, green, and blue color components. |
559
|
4 # |
904
|
5 # [R G B] = ind2rgb(X) uses the current colormap for the conversion. |
559
|
6 # |
904
|
7 # [R G B] = ind2rgb(X,map) uses the specified colormap. |
559
|
8 # |
904
|
9 # SEE ALSO: rgb2ind, image, imshow, ind2gray, gray2ind. |
559
|
10 |
|
11 if(nargin == 1) |
|
12 map = colormap; |
|
13 endif |
|
14 |
|
15 [hi wi] = size(X); |
|
16 |
|
17 pref = do_fortran_indexing; |
|
18 do_fortran_indexing = "true"; |
|
19 |
|
20 R = map(X(:),1); |
|
21 G = map(X(:),2); |
|
22 B = map(X(:),3); |
|
23 |
|
24 R = reshape(R,hi,wi); |
|
25 G = reshape(G,hi,wi); |
|
26 B = reshape(B,hi,wi); |
|
27 |
|
28 do_fortran_indexing = pref; |
|
29 |
|
30 endfunction |