clear all;
close all;
clc;
format long g;
format compact;
fontSize = 18;
fprintf('Beginning to run %s.m ...\n', mfilename);
rgbImage = imread('peppers.png');
subplot(3, 4, 1);
imshow(rgbImage);
title('RGB image', 'FontSize', fontSize);
labImage = rgb2lab(rgbImage);
lImage = labImage(:, :, 1);
subplot(3, 4, 2);
imshow(lImage, []);
title('L image', 'FontSize', fontSize);
labRed = rgb2lab([255, 0, 0])
labGreen = rgb2lab([0, 255, 0])
labBlue = rgb2lab([0, 0, 255])
labYellow = rgb2lab([255, 255, 0])
subplot(3, 4, 5);
imshow(lImage > labRed(1));
caption = sprintf('Pixels where image is\nbrighter than pure red.');
title(caption, 'FontSize', fontSize);
subplot(3, 4, 6);
imshow(lImage > labGreen(1));
caption = sprintf('Pixels where image is\nbrighter than pure green.');
title(caption, 'FontSize', fontSize);
subplot(3, 4, 7);
imshow(lImage > labBlue(1));
caption = sprintf('Pixels where image is\nbrighter than pure blue.');
title(caption, 'FontSize', fontSize);
subplot(3, 4, 8);
imshow(lImage > labYellow(1));
caption = sprintf('Pixels where image is\nbrighter than pure yellow.');
title(caption, 'FontSize', fontSize);
subplot(3, 4, 9);
imshow(lImage <= labRed(1));
caption = sprintf('Pixels where image is\ndarker than pure red.');
title(caption, 'FontSize', fontSize);
subplot(3, 4, 10);
imshow(lImage <= labGreen(1));
caption = sprintf('Pixels where image is\ndarker than pure green.');
title(caption, 'FontSize', fontSize);
subplot(3, 4, 11);
imshow(lImage <= labBlue(1));
caption = sprintf('Pixels where image is\ndarker than pure blue.');
title(caption, 'FontSize', fontSize);
subplot(3, 4, 12);
imshow(lImage <= labYellow(1));
caption = sprintf('Pixels where image is\ndarker than pure yellow.');
title(caption, 'FontSize', fontSize);
g = gcf;
g.WindowState = 'maximized';
fprintf('Done running %s.m.\n', mfilename);
0 Comments
Sign in to comment.