Working with color maps

4 views (last 30 days)
Ana Gabriela Guedes
Ana Gabriela Guedes on 2 Nov 2021
Answered: DGM on 2 Nov 2021
Hi!
Can someone please help me solving the following exercise? I think the way it is written is not very clear and I'm not beeing able to understand what I'm supposed to do or how after reading the image.
input: spine.tif from MATLAB
a) read the indexed image with the associated colormap
b) display:
• display 4 axes in one figure
• in the top left axes, show the colormap functions of all color channels with the corresponding color
• in the bottom left axes, show the image histogram with the same x-axis limits of the colormap functions
• in the top right axes, show the image with the colormap
• in the bottom right axes, show the image using the default linear mapping with the display range the same as the index value range
Thank you so much to anyone who can help even if with just one of the tasks

Answers (1)

DGM
DGM on 2 Nov 2021
You'll probably have to label things and whatnot. Could be done with tiledlayout() too, but I never use that.
[A map] = imread('spine.tif');
maxidx = max(A(:))+1;
subplot(2,2,1)
hold on;
plot(map(1:maxidx,1),'r')
plot(map(1:maxidx,2),'g')
plot(map(1:maxidx,3),'b')
subplot(2,2,3)
histogram(A,maxidx,'binmethod','integers')
subplot(2,2,2)
imshow(A,map)
subplot(2,2,4)
imshow(A,gray(double(maxidx)))

Community Treasure Hunt

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

Start Hunting!