matlab cuts colors from color map
Show older comments
Hello everyone,
I have a problem during pseudocoloring of my gray images with self defined colormaps. Here is the code:
in = imread('B0002_0003.png'); %uint8 image%
map = zeros(256,3);
x = 1:256;
map(:,1) = 1/2 - 1/2*sqrt(1 - (x/256).*(x/256));
map(:,2) = 0.8;
map(:,3) = (log(((x+1) / (256 + 1)))+5)/5;
figure;imshow(in,map);
o = ind2rgb(in,map);
figure;imshow(o);
[m, n] = rgb2ind(o,60000);
figure;plot(n);
figure;plot(map);
After execution of this code, the figure uses only 33 colors from the colormap. I conclude that from n variable. And it distorts my colormap. Why is this happening? How can I perform full coloring with definied colormap?
Accepted Answer
More Answers (0)
Categories
Find more on Images in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!