필터 지우기
필터 지우기

Stacking indexed images and view the resulting volume

조회 수: 1 (최근 30일)
Anand P
Anand P 2019년 6월 10일
답변: Subhadeep Koley 2021년 4월 8일
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?

답변 (1개)

Subhadeep Koley
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);

카테고리

Help CenterFile Exchange에서 Display Point Clouds에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by