InterviewSolution
| 1. |
What is output for rgb order in the attached program |
|
Answer» % READ in original RGB image.rgbImage = imread('flower.png');% Extract color channels.redChannel = rgbImage(:,:,1); % Red channelgreenChannel = rgbImage(:,:,2); % Green channelblueChannel = rgbImage(:,:,3); % Blue CHANNEL% CREATE an all black channel.allBlack = zeros(size(rgbImage, 1), size(rgbImage, 2), 'uint8');% Create color versions of the individual color channels.just_red = cat(3, redChannel, allBlack, allBlack);just_green = cat(3, allBlack, greenChannel, allBlack);just_blue = cat(3, allBlack, allBlack, blueChannel);% Recombine the individual color channels to create the original RGB image again.recombinedRGBImage = cat(3, redChannel, greenChannel, blueChannel);% Display them all.subplot(3, 3, 2);imshow(rgbImage);fontSize = 20;title('Original RGB Image', 'FontSize', fontSize)subplot(3, 3, 4);imshow(just_red);title('Red Channel in Red', 'FontSize', fontSize)subplot(3, 3, 5);imshow(just_green)title('Green Channel in Green', 'FontSize', fontSize)subplot(3, 3, 6);imshow(just_blue);title('Blue Channel in Blue', 'FontSize', fontSize)subplot(3, 3, 8);imshow(recombinedRGBImage);title('Recombined to Form Original RGB Image Again', 'FontSize', fontSize)% Set up figure properties:% Enlarge figure to full screen.set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0, 1, 1]);% GET rid of tool bar and pulldown menus that are ALONG top of figure.% set(gcf, 'Toolbar', 'none', 'Menu', 'none');% Give a name to the title bar.set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off') |
|