pkg load image clear clc I = imread('lena.bmp'); Icolor = uint8(zeros(256,256,3)); Ired = I(:,:,1); ##Igreen = I(:,:,2); ##Iblue = I(:,:,3); Icolor(1:128,1:128,1) = I(1:128,1:128); Icolor(1:128,129:256,2) = I(1:128,129:256); Icolor(129:256,1:128,3) = I(129:256,1:128); Icolor(129:256,129:256,1) = I(129:256,129:256); Icolor(129:256,129:256,2) = I(129:256,129:256); Icolor(129:256,129:256,3) = I(129:256,129:256); IcolorNeg = 255-Icolor; subplot(1,3,1), imshow(I,[0 255]), title('Original') subplot(1,3,2), imshow(Icolor,[0 255]), title('Color shades') subplot(1,3,3), imshow(IcolorNeg,[0 255]), title('Color shades negative')