【发布时间】:2014-09-17 21:16:25
【问题描述】:
我有一个灰度 matlab 图像,我想将其转换为带有自定义颜色图的 RGB 图像。我用我想要的颜色显示图像没有问题,但是当我使用 imwrite 时,该图不会保存为 RGB 图像。而不是 300x1000x3 的数据结构,它只是 300x1000。我该怎么做才能解决这个问题?
m=255;
map = ones(m,3);
strongsignal = [3, 7, 41]./ 255;
DRAQ = [100, 85, 105]./255;
R = linspace(DRAQ(1),strongsignal(1),254);
G = linspace(DRAQ(2),strongsignal(2),254);
B = linspace(DRAQ(3),strongsignal(3),254);
Sample = [R', G', B'];
i = imread('sliceXY045_660.png');
limits = graythresh(i);
i_adjust = im2bw(i,limits);
map(2:255,:)= Sample;
imagesc(i_adjust)
colormap(map)
imwrite(i_adjust,map,'colormap45.png')
【问题讨论】:
标签: image matlab image-processing colors