% % Homework #6: Working with Images in Matlab % Sample Solution % clear all colormap('default'); load clown flowers = imread('flowers.tif'); % Using clown... image(X); colormap(map); pause % 1. a) How many colors are there in clown? Ans: 81 Colors. whos; % Shows variable names and dimensions size(map); % 81x3 array. Number of rows indicates the number of % colors. There is one column for each RGB color component. % b) Display the color of the pixel at location 100x100. image(X(100,100)); pause; % Using Flowers... colormap('default'); % Not necessary. But we'll do it for good measure. image(flowers); pause; % 2. a) What are the RGB components of location 21x34? r = flowers(21,34,1); % Red (66) g = flowers(21,34,2); % Green (62) b = flowers(21,34,3); % Blue (97) % 2. b) What color is this? image(flowers(21,34,:)); % Dark green/blue.