MATLAB Answers

Stacking indexed images and view the resulting volume

1 view (last 30 days)
Anand P
Anand P on 10 Jun 2019
Edited: Anand P on 10 Jun 2019
I have used the following code to convert RGB images to indexed image and stack them as a cube
A =imread('image2.png'); %A is a RGB image
B =imread('image3.png'); %B is a RGB image
C =imread('image4.png'); %C is a RGB image
[D,map] = rgb2ind(A,256); %D is an indexed image
E = rgb2ind(B,map); %D is an indexed image
F = rgb2ind(C,map); %D is an indexed image
G = zeros(size(A,1),size(A,2),3) %%G is my volume here
%%Note that A,B and C have the same dimensions. Similarly D,E and F have the same dimensions
G(:,:,1)=D;
G(:,:,2)=E;
G(:,:,3)=F;
The indexed image is viewed using the code
figure
imagesc(E)
colormap(map)
In a similar manner, how can I view my cube G using the same colormap?

  0 Comments

Sign in to comment.

Answers (0)

Sign in to answer this question.