% simpleRGBimage2.m manually specifies intensities as uint8 I = uint8(255*ones(20,20)); % a block of 255's, unsigned integers Z = uint8(zeros(20,20)); % a block of zeros clear A % clear out A clf subplot(2,2,1) % A consists of 3 matrices A(:,:,1) = [[I Z]; [Z Z]]; % The first tells red intensities A(:,:,2) = [[Z I]; [Z Z]]; % The second tells green A(:,:,3) = [[Z Z]; [I Z]]; % The third tells blue imshow(A); % When A is uint8, 0<=A<=256 subplot(2,2,2) A(:,:,1) = [[I I]; [Z Z]]; % Top of image has red intensity one A(:,:,2) = [[Z I]; [Z I]]; % Right side has green intensity one A(:,:,3) = [[Z Z]; [I I]]; % Bottom has blue intensity one imshow(A); subplot(2,2,3) I = uint8(0.5*double(I)); % Convert to double, halve, convert back A(:,:,1) = [[I Z]; [Z Z]]; % The first tells red intensities A(:,:,2) = [[Z I]; [Z Z]]; % The second tells green A(:,:,3) = [[Z Z]; [I Z]]; % The third tells blue imshow(A); subplot(2,2,4) A(:,:,1) = [[I I]; [I Z]]; % All intensities have high values A(:,:,2) = [[Z I]; [I I]]; A(:,:,3) = [[I Z]; [I I]]; imshow(A);