创建一个大小为(rows,cols,3)的数组,其中(rows,cols)是灰色图像的大小。使其红色通道等于255,其他通道等于灰度图像
img = imread('moon.tif');
[r,c,z] = size(img);
red_img = uint8(zeros(r,c,3));
red_img(:,:,1) = 255;
red_img(:,:,2) = img;
red_img(:,:,3) = img;
subplot(1,2,1);
imshow(img,[]);
subplot(1,2,2);
imshow(red_img,[]);