我知道如何执行相反的rgb2gray(img)
,但我无法找到可以从灰度转换为gray2rgb(img) >真彩
是否有其他功能可以做到这一点?
答案 0 :(得分:2)
nice function made by Gabriel Frangakis:
function [Image]=gray2rgb(Image)
%Gives a grayscale image an extra dimension
%in order to use color within it
[m n]=size(Image);
rgb=zeros(m,n,3);
rgb(:,:,1)=Image;
rgb(:,:,2)=rgb(:,:,1);
rgb(:,:,3)=rgb(:,:,1);
Image=rgb/255;
end
您应该为每个坐标RGB