Stacking indexed images and view the resulting volume
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Subhadeep Koley
2021-4-8
This code snippet might help.
A = imread('image2.png');
B = imread('image3.png');
C = imread('image4.png');
[D, map] = rgb2ind(A, 256);
E = rgb2ind(B, map);
F = rgb2ind(C, map);
G = cat(3, D, E, F);
figure
volshow(G, 'Colormap', map);
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!