Viewing a volumetric data using user defined colormap

3 views (last 30 days)
Anand P
Anand P on 8 Jun 2019
Commented: Anand P on 10 Jun 2019
Initially I have converted an RGB image, represented by a 3 dimensional matrix into an indexed image represented by a 2 dimensional matrix using
[IND1,map] = rgb2ind(RGB1,256); where RGB1 is my RGB image and IND1 is my indexed image
I have done this for another RGB image RGB2 using
[IND2,map] = rgb2ind(RGB2,256);
Then I have stacked the indexed image, IND1 and IND2 into a matrix A so that A becomes a 3-D volume. This is done using the following code
A(:,:,1) = IND1
A(:,:,2) = IND2
Image IND1 and IND2 is viewed using the following code. I was able to view IND1 and IND2 in accordance with my colormap
When I made an attempt to view the 3D volume 'A' using the follwing code, the volume is displayed in black and white and not in the colormap defined by me (ie 'map')
What improvements can i do in the code so that I am able to view the volume in the colormap defined by me ?
size of RGB1 and RGB2 = 256*256*3;
size of IND1 and IND2 = 256*256;
size of A is 256 *256 *2
Thanks in advance

Answers (1)

Walter Roberson
Walter Roberson on 8 Jun 2019
[IND1,map] = rgb2ind(RGB1,256);
[IND2,map] = rgb2ind(RGB2,256);
Those two are converted into different maps. You should be using
IND2 = rgb2ind(RGB2, map);
Anand P
Anand P on 10 Jun 2019
So, is it possible to stack up indexed images and view the resulting volume using the same colors used to view indexed images. If yes, can you provide me the code. Thanks in advance.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!